Project

General

Profile

Feature #10069 » implement_negate_for_matrix.patch

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

View differences:

NEWS
by deleting the specified row and column.
* Matrix#cofactor(row, column) returns the (row, column) cofactor
which is obtained by multiplying the first minor by (-1)**(row + column).
* Matrix#@+ and Matrix#@- .
* Method
* New methods:
lib/matrix.rb
# * #inv
# * #**
# * #+@
# * #-@
#
# Matrix functions:
# * #determinant
......
self
end
def -@
collect {|e| -e }
end
#--
# MATRIX FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#++
test/matrix/test_matrix.rb
assert_equal(@m1, +@m1)
end
def test_negate
assert_equal(Matrix[[-1, -2, -3], [-4, -5, -6]], -@m1)
assert_equal(@m1, -(-@m1))
end
def test_rank
[
[[0]],
(2-2/2)