Feature #10068 » implement_negate_for_vector.patch
| NEWS | ||
|---|---|---|
|
which is obtained by multiplying the first minor by (-1)**(row + column).
|
||
|
* Matrix#@+ and Matrix#@- .
|
||
|
* Vector
|
||
|
* New methods:
|
||
|
* Vector#@+ and Vector#@- .
|
||
|
* Method
|
||
|
* New methods:
|
||
|
* Method#curry([arity]) returns a curried Proc.
|
||
| lib/matrix.rb | ||
|---|---|---|
|
# * #+(v)
|
||
|
# * #-(v)
|
||
|
# * #+@
|
||
|
# * #-@
|
||
|
#
|
||
|
# Vector functions:
|
||
|
# * #inner_product(v)
|
||
| ... | ... | |
|
self
|
||
|
end
|
||
|
def -@
|
||
|
collect {|e| -e }
|
||
|
end
|
||
|
#--
|
||
|
# VECTOR FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||
|
#++
|
||
| test/matrix/test_vector.rb | ||
|---|---|---|
|
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
|
||
- « Previous
- 1
- 2
- Next »