1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/matrix.rb: fix previous optimization

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2009-09-16 07:17:22 +00:00
parent 52c3721af3
commit 193a7db4e2

View file

@ -669,7 +669,7 @@ class Matrix
if (akk = a[k][k]) == 0 if (akk = a[k][k]) == 0
i = k i = k
loop do loop do
return 0 if (i += 1) > size return 0 if (i += 1) >= size
break unless a[i][k] == 0 break unless a[i][k] == 0
end end
a[i], a[k] = a[k], a[i] a[i], a[k] = a[k], a[i]
@ -710,7 +710,7 @@ class Matrix
if a[k][k].zero? if a[k][k].zero?
i = k i = k
loop do loop do
return 0 if (i += 1) > size return 0 if (i += 1) >= size
break unless a[i][k].zero? break unless a[i][k].zero?
end end
a[i], a[k] = a[k], a[i] a[i], a[k] = a[k], a[i]
@ -771,7 +771,7 @@ class Matrix
i = k i = k
exists = true exists = true
loop do loop do
if (i += 1) > a_row_size - 1 if (i += 1) >= a_row_size
exists = false exists = false
break break
end end