summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-10 17:11:36 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-10 17:11:36 +0000
commit9ca073576ca27c4af316720aa0aec2da2230c021 (patch)
treeb103e051e1a91a04c64bcb1b75cc09af6e788111 /lib
parentcc502757d0f8dea1df628aa08facbf12c7ca87d4 (diff)
merges r24969 from trunk into ruby_1_9_1, and adds a test for the fix.
-- * lib/matrix.rb (Matrix#rank): Two bug fixes. One made Matrix[[0,0],[0,0],[1,0]].rank raise a NoMethodError while the other one had Matrix[[0,1],[0,0],[1,0]].rank raise a TypeError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@25708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/matrix.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 88ccbca6b0..04616d00d8 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -776,7 +776,7 @@ class Matrix
i = k
exists = true
loop do
- if (i += 1) > a_column_size - 1
+ if (i += 1) > a_row_size - 1
exists = false
break
end
@@ -789,14 +789,14 @@ class Matrix
i = k
exists = true
loop do
- if (i += 1) > a_row_size - 1
+ if (i += 1) > a_column_size - 1
exists = false
break
end
break unless a[k][i] == 0
end
if exists
- k.upto(a_column_size - 1) do |j|
+ k.upto(a_row_size - 1) do |j|
a[j][k], a[j][i] = a[j][i], a[j][k]
end
akk = a[k][k]