diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/matrix.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb index 9d6650370d..7d35b61fc5 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -890,11 +890,12 @@ class Matrix # def orthogonal? raise ErrDimensionMismatch unless square? - rows.each_with_index do |row, i| - column_count.times do |j| + + rows.each_with_index do |row_i, i| + rows.each_with_index do |row_j, j| s = 0 row_count.times do |k| - s += row[k] * rows[k][j] + s += row_i[k] * row_j[k] end return false unless s == (i == j ? 1 : 0) end |