mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02: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:
parent
49e9f4714e
commit
a2ae7bccf8
5 changed files with 45 additions and 1 deletions
|
@ -120,6 +120,15 @@ class TestVector < Test::Unit::TestCase
|
|||
assert_equal(0, Vector[1, 2, 3] - o)
|
||||
end
|
||||
|
||||
def test_uplus
|
||||
assert_equal(@v1, +@v1)
|
||||
end
|
||||
|
||||
def test_negate
|
||||
assert_equal(Vector[-1, -2, -3], -@v1)
|
||||
assert_equal(@v1, -(-@v1))
|
||||
end
|
||||
|
||||
def test_inner_product
|
||||
assert_equal(1+4+9, @v1.inner_product(@v1))
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue