/usr/lib/ruby/1.8/gsl/oper.rb is in libgsl-ruby1.8 1.14.3-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | class Fixnum
alias :_orig_mul :*
alias :_orig_div :/
def *(other)
if other.kind_of?(GSL::Matrix) or other.kind_of?(GSL::Vector) or other.kind_of?(GSL::Matrix::Int) or other.kind_of?(GSL::Vector::Int) or other.kind_of?(GSL::Vector::Complex)or other.kind_of?(GSL::Matrix::Complex)
other.scale(self)
else
if GSL.have_tensor?
if other.kind_of?(GSL::Tensor) or other.kind_of?(GSL::Tensor::Int)
other.scale(self)
else
self._orig_mul(other)
end
else
self._orig_mul(other)
end
end
end
def /(other)
if other.kind_of?(GSL::Poly) or other.kind_of?(GSL::Poly::Int)
a = GSL::Poly[1]; a[0] = self
GSL::Rational.new(a, other)
elsif other.kind_of?(GSL::Vector::Col)
other.scale(1.0/GSL::pow_2(other.dnrm2))
elsif other.kind_of?(GSL::Vector::Int::Col)
v = other.to_f
v.scale(1.0/GSL::pow_2(v.dnrm2))
else
self._orig_div(other)
end
end
end
class Float
alias :_orig_mul :*
alias :_orig_div :/
def *(other)
if other.kind_of?(GSL::Matrix) or other.kind_of?(GSL::Vector) or other.kind_of?(GSL::Matrix::Int) or other.kind_of?(GSL::Vector::Int) or other.kind_of?(GSL::Vector::Complex)or other.kind_of?(GSL::Matrix::Complex)
other.scale(self)
else
if GSL.have_tensor?
if other.kind_of?(GSL::Tensor) or other.kind_of?(GSL::Tensor::Int)
other.scale(self)
else
self._orig_mul(other)
end
else
self._orig_mul(other)
end
end
end
def /(other)
if other.kind_of?(GSL::Poly) or other.kind_of?(GSL::Poly::Int)
a = GSL::Poly[1]; a[0] = self
GSL::Rational.new(a, other)
elsif other.kind_of?(GSL::Vector::Col)
other.scale(1.0/GSL::pow_2(other.dnrm2))
elsif other.kind_of?(GSL::Vector::Int::Col)
v = other.to_f
v.scale(1.0/GSL::pow_2(v.dnrm2))
else
self._orig_div(other)
end
end
end
|