Feature #10073

[PATCH] Implement Laplace expansion for matrix.

Added by gogo tanaka 9 months ago. Updated 7 months ago.

[ruby-core:63859]
Status:Closed
Priority:Normal
Assignee:Marc-Andre Lafortune

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.

implement_Matrix#laplace_expansion.patch Magnifier (3.31 KB) gogo tanaka, 07/19/2014 07:40 AM

add_test_for_laplace_expansion.patch Magnifier (1.78 KB) gogo tanaka, 10/06/2014 02:33 AM

update_news.patch Magnifier (772 Bytes) gogo tanaka, 10/06/2014 02:33 AM

implementing_laplace_expansion.patch Magnifier (1.81 KB) gogo tanaka, 10/06/2014 02:33 AM

Associated revisions

Revision 47835
Added by Marc-Andre Lafortune 7 months ago

  • lib/matrix.rb: Add Matrix#laplace_expansion. patch by gogo tanaka [#10073]

Revision 47835
Added by Marc-Andre Lafortune 7 months ago

  • lib/matrix.rb: Add Matrix#laplace_expansion. patch by gogo tanaka [#10073]

History

#1 Updated by gogo tanaka 9 months 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.

#2 Updated by Hiroshi SHIBATA 9 months ago

  • Assignee set to Marc-Andre Lafortune
  • Target version set to current: 2.2.0
  • Category set to lib

#3 Updated by Hiroshi SHIBATA 9 months ago

  • Status changed from Open to Assigned

#4 Updated by Marc-Andre Lafortune 7 months 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?

#5 Updated by gogo tanaka 7 months 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.

#6 Updated by Marc-Andre Lafortune 7 months ago

Just to be clear: you'd like me to wait for an updated patch, or should I make the small changes myself?

#7 Updated by gogo tanaka 7 months ago

Sorry, I should make that be clear.

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

#8 Updated by gogo tanaka 7 months ago

@Marc-Andre Lafortune

Thank you for your great proposal.

#9 Updated by Marc-Andre Lafortune 7 months ago

  • Status changed from Assigned to Closed

Great, thanks for the updated patch.

Also available in: Atom PDF