Class: Float

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

Instance Method Summary collapse

Instance Method Details

#*(other) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/gsl/oper.rb', line 39

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



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/gsl/oper.rb', line 55

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



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

alias :_orig_div :/

#_orig_mulObject



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

alias :_orig_mul :*