From dc38c877792287240f7ee37d6444da9801a21f57 Mon Sep 17 00:00:00 2001 From: marcandre Date: Wed, 29 Oct 2014 02:42:56 +0000 Subject: * lib/matrix.rb: Add aliases for Vector#cross & dot patch by gogo tanaka [#10352] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/matrix.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/matrix.rb b/lib/matrix.rb index b39973b93f..cdaa55f157 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1684,8 +1684,8 @@ end # * #-@ # # Vector functions: -# * #inner_product(v) -# * #cross_product(v) +# * #inner_product(v), dot(v) +# * #cross_product(v), cross(v) # * #collect # * #magnitude # * #map @@ -1944,6 +1944,7 @@ class Vector } p end + alias_method :dot, :inner_product # # Returns the cross product of this vector with the other. @@ -1955,6 +1956,7 @@ class Vector v[0]*@elements[2] - v[2]*@elements[0], v[1]*@elements[0] - v[0]*@elements[1] ] end + alias_method :cross, :cross_product # # Like Array#collect. -- cgit v1.2.3