Feature #10068 » implement_uplus_for_vector.patch
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
|