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

* lib/matrix.rb (determinant): Bug fix where determinant failed on some matrices [ruby-core:23597]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2009-09-16 04:39:51 +00:00
parent c3db24a4dc
commit 52c3721af3
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Wed Sep 16 13:39:10 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
* lib/matrix.rb (determinant): Bug fix where determinant failed on
some matrices [ruby-core:23597]
Wed Sep 16 13:30:20 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca> Wed Sep 16 13:30:20 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
* lib/matrix.rb: trivial optimizations * lib/matrix.rb: trivial optimizations

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 (ii += 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]