Project

General

Profile

Actions

Bug #2770

closed

Matrix: determinant for rectangular matrices should raise an error [patch]

Added by marcandre (Marc-Andre Lafortune) about 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2010-01-13 trunk 26316) [x86_64-darwin10.2.0]
Backport:
[ruby-core:28271]

Description

=begin
Keiju,

$ rubydev -r matrix -e "puts Matrix[[1], [2], [3]].determinant"
0

This corresponds to the documentation, but is not mathematically valid, since the determinant for rectangular matrices is not defined (at least for now! http://bit.ly/bwW7Gs )

I believe an error should be thrown, similar to:
$ rubydev -r matrix -e "puts Matrix[[1], [2], [3]].trace"
/usr/local/rubydev/lib/ruby/1.9.1/matrix.rb:837:in trace': Matrix dimension mismatch (ExceptionForMatrix::ErrDimensionMismatch) from -e:1:in '

Since this is an API change, I attached a patch and will wait for your approval before committing.
=end


Files

matrix_det.diff (1.48 KB) matrix_det.diff marcandre (Marc-Andre Lafortune), 02/21/2010 04:46 AM
Actions #1

Updated by marcandre (Marc-Andre Lafortune) almost 14 years ago

  • Category set to lib
  • Assignee changed from keiju (Keiju Ishitsuka) to marcandre (Marc-Andre Lafortune)
  • Target version set to 1.9.2

=begin

=end

Actions #2

Updated by marcandre (Marc-Andre Lafortune) almost 14 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27160.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0