* 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
This commit is contained in:
marcandre 2010-04-29 18:18:58 +00:00
Родитель 4e6a29e083
Коммит a3a4542fb4
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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
#