From a3a4542fb4779a1f4f302126c5e8d7fc024ade4b Mon Sep 17 00:00:00 2001 From: marcandre Date: Thu, 29 Apr 2010 18:18:58 +0000 Subject: * lib/matrix.rb (Matrix#singular?, Matrix#regular?): raise on rectangular matrices, and use determinant instead of rank. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/matrix.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/matrix.rb') diff --git a/lib/matrix.rb b/lib/matrix.rb index 0f4633212c..12116dbe99 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -478,17 +478,17 @@ class Matrix 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 # -- cgit v1.2.3