Issue #10056 has been updated by Tomoyuki C…
Hello,
The patch seems fine to me.
I’d like to add some assertions for the testcase.
These are deribed from “Properties of Adjugate matrix” in Wikipedia.
tanaka san, how about it?
## adj(I) = I
assert_equal(Matrix.identity(2), Matrix.identity(2).adjugate)
assert_equal(Matrix.identity(3), Matrix.identity(3).adjugate)
## adj(A * B) = ajd(B) * adj(A)
a = Matrix[[4, 1, -3], [0, 3, 7], [11, -4, 2]]
b = Matrix[[-7, 7, -10], [9, -3, -2], [-1, 3, 9]]
assert_equal((a * b).adjugate, b.adjugate * a.adjugate)
## adj(cA) = c^(n-1) * adj(A)
assert_equal((3**2) * a.adjugate, (3 * a).adjugate)
Marc-Andre, how do you think?
Feature #10056: [PATCH 0/1]Add #adjugate method to matrix class
- Author: gogo tanaka
- Status: Assigned
- Priority: Normal
- Assignee: Marc-Andre L.
- Category:
- Target version:
Add Matrix#adjugate to make a matrix adjugate.
Adjugate is really important operator to handle matrix (especially
Exploring Data with ruby)
# Property
* Any n-th matrix `m`(object of Matrix class) Satisfy the following
conditions
Matrix.identity(n) == (m.adjugate * m) / m.det
# Differential vector or matrix
Let A = (a(i, j)) is n-th matrix, A(i, j) is adjugate matrix excluding
the j and column i row A.
def. ∂det(A)/∂a(i,j) = (-1) ** (i + j) * det(A(i, j))
Some people regards adjugate matrix as Hermitian adjoint.
I regard adjuate matrix as transpose of the cofactor matrix by
referencing Adjugate matrix - Wikipedia.
—Files--------------------------------
add_matrix#adjugate_method.patch (2.22 KB)