1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/matrix.rb: Add @- and @+ for Matrix and Vector.

patch by gogo tanaka [#10068] [#10069]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2014-10-07 20:18:35 +00:00
parent 49e9f4714e
commit a2ae7bccf8
5 changed files with 45 additions and 1 deletions

View file

@ -62,6 +62,15 @@ class TestMatrix < Test::Unit::TestCase
assert_equal @m1.hash, @m3.hash
end
def test_uplus
assert_equal(@m1, +@m1)
end
def test_negate
assert_equal(Matrix[[-1, -2, -3], [-4, -5, -6]], -@m1)
assert_equal(@m1, -(-@m1))
end
def test_rank
[
[[0]],