diff options
Diffstat (limited to 'lib/matrix.rb')
-rw-r--r-- | lib/matrix.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb index 923e716b35..4a61976b0e 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -802,6 +802,18 @@ class Matrix end # + # Returns +true+ if this is an antisymmetric matrix. + # Raises an error if matrix is not square. + # + def antisymmetric? + Matrix.Raise ErrDimensionMismatch unless square? + each_with_index(:upper) do |e, row, col| + return false unless e == -rows[col][row] + end + true + end + + # # Returns +true+ if this is a unitary matrix # Raises an error if matrix is not square. # |