Project

General

Profile

Feature #10073

[PATCH] Implement Laplace expansion for matrix.

Added by gogo tanaka over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
[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.

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 over 1 year ago

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

Revision 47835
Added by Marc-Andre Lafortune over 1 year ago

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

History

#1 [ruby-core:63879] Updated by gogo tanaka over 1 year 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 [ruby-core:63899] Updated by Hiroshi SHIBATA over 1 year ago

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

#3 [ruby-core:63900] Updated by Hiroshi SHIBATA over 1 year ago

  • Status changed from Open to Assigned

#4 [ruby-core:65178] Updated by Marc-Andre Lafortune over 1 year 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 [ruby-core:65289] Updated by gogo tanaka over 1 year 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 [ruby-core:65379] Updated by Marc-Andre Lafortune over 1 year ago

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

#7 [ruby-core:65394] Updated by gogo tanaka over 1 year ago

Sorry, I should make that be clear.

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

#8 [ruby-core:65428] Updated by gogo tanaka over 1 year ago

@Marc-Andre Lafortune

Thank you for your great proposal.

#9 [ruby-core:65491] Updated by Marc-Andre Lafortune over 1 year ago

  • Status changed from Assigned to Closed

Great, thanks for the updated patch.

Also available in: Atom PDF