Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/gsl/oper.rb

Instance Method Summary collapse

Instance Method Details

#*(other) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gsl/oper.rb', line 4

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

#/(other) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gsl/oper.rb', line 20

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

#_orig_divObject



3
# File 'lib/gsl/oper.rb', line 3

alias :_orig_div :/

#_orig_mulObject



2
# File 'lib/gsl/oper.rb', line 2

alias :_orig_mul :*