Project

General

Profile

Feature #10073

[PATCH] Implement Laplace expansion for matrix.

Added by gogotanaka (Kazuki Tanaka) almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:63859]

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

implement_Matrix#laplace_expansion.patch (3.31 KB) implement_Matrix#laplace_expansion.patch gogotanaka (Kazuki Tanaka), 07/19/2014 07:40 AM
add_test_for_laplace_expansion.patch (1.78 KB) add_test_for_laplace_expansion.patch gogotanaka (Kazuki Tanaka), 10/06/2014 02:33 AM
update_news.patch (772 Bytes) update_news.patch gogotanaka (Kazuki Tanaka), 10/06/2014 02:33 AM
implementing_laplace_expansion.patch (1.81 KB) implementing_laplace_expansion.patch gogotanaka (Kazuki Tanaka), 10/06/2014 02:33 AM

Updated by gogotanaka (Kazuki Tanaka) almost 6 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) almost 6 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) almost 6 years ago

  • Status changed from Open to Assigned

Updated by marcandre (Marc-Andre Lafortune) over 5 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) over 5 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) over 5 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) over 5 years ago

Sorry, I should make that be clear.

OK, I'll update patch. Please wait for some time.

Updated by marcandre (Marc-Andre Lafortune) over 5 years ago

  • Status changed from Assigned to Closed

Great, thanks for the updated patch.

Also available in: Atom PDF