summaryrefslogtreecommitdiff
path: root/lib/matrix.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-29 18:18:58 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-29 18:18:58 +0000
commita3a4542fb4779a1f4f302126c5e8d7fc024ade4b (patch)
tree42acb581c55146f9617458d5a896f964b2b7b4a2 /lib/matrix.rb
parent4e6a29e083c03ccf9611120668336458160c27f9 (diff)
* 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
Diffstat (limited to 'lib/matrix.rb')
-rw-r--r--lib/matrix.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 0f46332..12116db 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
#