ruby-changes:15638
From: marcandre <ko1@a...>
Date: Fri, 30 Apr 2010 03:19:10 +0900 (JST)
Subject: [ruby-changes:15638] Ruby:r27553 (trunk): * lib/matrix.rb (Matrix#singular?, Matrix#regular?): raise on rectangular
marcandre 2010-04-30 03:18:58 +0900 (Fri, 30 Apr 2010) New Revision: 27553 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27553 Log: * lib/matrix.rb (Matrix#singular?, Matrix#regular?): raise on rectangular matrices, and use determinant instead of rank. Modified files: trunk/lib/matrix.rb Index: lib/matrix.rb =================================================================== --- lib/matrix.rb (revision 27552) +++ lib/matrix.rb (revision 27553) @@ -478,17 +478,17 @@ end # - # Returns +true+ if this is a regular matrix. + # Returns +true+ if this is a regular (i.e. non-singular) matrix. # def regular? - square? and rank == column_size + not singular? end # - # Returns +true+ is this is a singular (i.e. non-regular) matrix. + # Returns +true+ is this is a singular matrix. # def singular? - not regular? + determinant == 0 end # -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/