diff --git a/lib/matrix.rb b/lib/matrix.rb index fe76ca0..6fa1a42 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1573,6 +1573,7 @@ end # * #*(x) "is matrix or number" # * #+(v) # * #-(v) +# * #+@ # # Vector functions: # * #inner_product(v) @@ -1797,6 +1798,10 @@ class Vector end end + def +@ + self + end + #-- # VECTOR FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ diff --git a/test/matrix/test_vector.rb b/test/matrix/test_vector.rb index b172f96..fc3aa15 100644 --- a/test/matrix/test_vector.rb +++ b/test/matrix/test_vector.rb @@ -111,6 +111,10 @@ class TestVector < Test::Unit::TestCase assert_equal(0, Vector[1, 2, 3] - o) end + def test_uplus + assert_equal(@v1, +@v1) + end + def test_inner_product assert_equal(1+4+9, @v1.inner_product(@v1)) end