Project

General

Profile

Feature #10068 » implement_uplus_for_vector.patch

gogotanaka (Kazuki Tanaka), 07/19/2014 01:56 AM

View differences:

lib/matrix.rb
# * #*(x) "is matrix or number"
# * #+(v)
# * #-(v)
# * #+@
#
# Vector functions:
# * #inner_product(v)
......
end
end
def +@
self
end
#--
# VECTOR FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#++
test/matrix/test_vector.rb
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
(1-1/2)