diff options
author | Marc-Andre Lafortune <[email protected]> | 2020-04-30 17:49:06 -0400 |
---|---|---|
committer | Marc-Andre Lafortune <[email protected]> | 2020-05-01 03:25:05 -0400 |
commit | 7d360efe92d2db11a4e51820ed2f52de36b3257f (patch) | |
tree | 7891bffb9aee578d075ca8f0a4c6e23f24fadca8 /lib/matrix.rb | |
parent | c925cc01c5e8d595449156556416f067b914f6ca (diff) |
[ruby/matrix] Fix Matrix#unitary? [#14]
Diffstat (limited to 'lib/matrix.rb')
-rw-r--r-- | lib/matrix.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb index a0f116095c..9d6650370d 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -983,11 +983,11 @@ class Matrix # def unitary? 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].conj * rows[k][j] + s += row_i[k].conj * row_j[k] end return false unless s == (i == j ? 1 : 0) end |