Class: Matrix

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

Instance Method Summary collapse

Instance Method Details

#*(another) ⇒ Object



5
6
7
8
# File 'lib/matrix_extensions.rb', line 5

def *(another)
	return multiply(Matrix.columns([[another[:x], another[:y]]])) if another.kind_of? Hash
	multiply(another)
end

#as_hashObject



10
11
12
# File 'lib/matrix_extensions.rb', line 10

def as_hash
	{:x => self[0,0], :y => self[1,0]}
end

#multiplyObject



4
# File 'lib/matrix_extensions.rb', line 4

alias_method :multiply, :*