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

* lib/matrix.rb (symmetric?): Trivial optimization

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2011-12-30 06:04:04 +00:00
parent f965d51384
commit b906a46edd

View file

@ -718,9 +718,10 @@ class Matrix
#
def symmetric?
Matrix.Raise ErrDimensionMismatch unless square?
each_with_index(:strict_upper).all? do |e, row, col|
e == rows[col][row]
each_with_index(:strict_upper) do |e, row, col|
return false if e != rows[col][row]
end
true
end
#