Feature #10073
closed[PATCH] Implement Laplace expansion for matrix.
Description
Laplace expansion has really important mathematical property.
We can handle many thing with this (determinant, cross product)
So I'm confident that this method is necessary.
But I recognize Ruby should be not for mathematician but rubyist.
Ruby doesn't need too academic method.
So If you think it is too academic you can ignore my patches.
gogo.
Files
Updated by gogotanaka (Kazuki Tanaka) over 10 years ago
For all n * n matrix m, k <- {1, 2, ..., n}.
m.laplace_expansion(k-1, :row) == m.laplace_expansion(k-1, :column) == m.det
It is important when we think about values contains not Scalar, like that.
Matrix[[Vector[1, 0], Vector[0, 1]], [2, 3]].laplace_expansion(0, :row)
=> Vector[3, -2]
And, this patch is needed in https://bugs.ruby-lang.org/issues/10074.
gogo.
Updated by hsbt (Hiroshi SHIBATA) over 10 years ago
- Category set to lib
- Assignee set to marcandre (Marc-Andre Lafortune)
- Target version set to 2.2.0
Updated by hsbt (Hiroshi SHIBATA) over 10 years ago
- Status changed from Open to Assigned
Updated by marcandre (Marc-Andre Lafortune) about 10 years ago
Looks good.
I'd change the interface slightly so we can call it with named parameters instead:
m.laplace_expansion(row: k-1) == m.laplace_expansion(column: k-1) == m.det
Of course, m.laplace_expansion or m.laplace_expansion(row: 0, column: 0) would raise errors.
@gogo tanaka: what do you think about this?
Updated by gogotanaka (Kazuki Tanaka) about 10 years ago
@Marc-Andre Lafortune
Thank you very much for responding.
m.laplace_expansion(row: k-1) == m.laplace_expansion(column: k-1) == m.det
The interface you suggested is really make sense for me.
OK, Let me handle this.
Updated by marcandre (Marc-Andre Lafortune) about 10 years ago
Just to be clear: you'd like me to wait for an updated patch, or should I make the small changes myself?
Updated by gogotanaka (Kazuki Tanaka) about 10 years ago
Sorry, I should make that be clear.
OK, I'll update patch. Please wait for some time.
Updated by gogotanaka (Kazuki Tanaka) about 10 years ago
- File update_news.patch update_news.patch added
- File add_test_for_laplace_expansion.patch add_test_for_laplace_expansion.patch added
- File implementing_laplace_expansion.patch implementing_laplace_expansion.patch added
@Marc-Andre Lafortune
Thank you for your great proposal.
Updated by marcandre (Marc-Andre Lafortune) about 10 years ago
- Status changed from Assigned to Closed
Great, thanks for the updated patch.