Class: FastMatrix::Scalar

Inherits:
Numeric
  • Object
show all
Defined in:
lib/scalar.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Scalar

Returns a new instance of Scalar.



45
46
47
# File 'lib/scalar.rb', line 45

def initialize(value)
  @value = value
end

Instance Method Details

#*(other) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/scalar.rb', line 49

def *(other)
  case other
  when Vector, Matrix
    other * @value
  else
    Scalar.new(@value * other)
  end
end