summaryrefslogtreecommitdiff
path: root/lib/matrix.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-29 02:42:56 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-29 02:42:56 +0000
commitdc38c877792287240f7ee37d6444da9801a21f57 (patch)
tree962ef238acbc752402dbc7543a017d391c1cad2f /lib/matrix.rb
parent9419ecc6e9092e0133cfc8c44d87c6d70c6ace28 (diff)
* 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
Diffstat (limited to 'lib/matrix.rb')
-rw-r--r--lib/matrix.rb6
1 files changed, 4 insertions, 2 deletions
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.