From b906a46edd76e873cec0714eb1e96d68caec363c Mon Sep 17 00:00:00 2001 From: marcandre Date: Fri, 30 Dec 2011 06:04:04 +0000 Subject: [PATCH] * lib/matrix.rb (symmetric?): Trivial optimization git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/matrix.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/matrix.rb b/lib/matrix.rb index 7a20fae520..7569d68607 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -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 #