diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-10 17:11:36 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-10 17:11:36 +0000 |
| commit | ccb7eb0659ce75b53f6233f4e78eb4d0ea93acab (patch) | |
| tree | b103e051e1a91a04c64bcb1b75cc09af6e788111 /lib | |
| parent | f89ceb51895a5a70035783eb7f6103d41152fd0e (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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@25708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/matrix.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb index 88ccbca6b..04616d00d 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] |
