-
Notifications
You must be signed in to change notification settings - Fork 2
Matrix Predicates
Returns true if this is an antisymmetric matrix. Raises an error if matrix is not square.
m = Matrix[
[ 0, 1, -3],
[-1, 0, -5],
[ 3, 5, 0]]
m.antisymmetric?
# => true
Returns true if this is a diagonal matrix. Raises an error if matrix is not square.
m = Matrix[[2, 0, 0], [0, 3, 0], [0, 0, 5]]
m.diagonal?
# => true
Returns true if this is an empty matrix, but our matrix is never empty. So it always returns false.
Alias for: symmetric?. Implemented just for compatibility with standard matrix.
Returns true if this is a lower triangular matrix.
m = Matrix[[1, 0, 0], [1, 2, 0], [3, 3, 3]]
m.lower_triangular?
# => true
Returns true if this is an upper triangular matrix.
m = Matrix[[1, 2, 3], [0, 2, 3], [0, 0, 4]]
m.upper_triangular?
# => true
Returns true if this is a normal matrix. Raises an error if matrix is not square.
Remember that our matrix does not support complex numbers!
m = Matrix[[1, 1, 0], [0, 1, 1], [1, 0, 1]]
m.normal?
# => true
Returns true if this is an orthogonal matrix Raises an error if matrix is not square.
m = Matrix[[0.96, -0.28], [0.28, 0.96]]
m.orthogonal?
# => true
Returns true if this is a permutation matrix Raises an error if matrix is not square.
m = Matrix[[0, 1, 0], [1, 0, 0], [0, 0, 1]]
m.permutation?
# => true
Returns true if this is a regular (i.e. non-singular) matrix.
m = Matrix[[1, 0], [0, 1]]
m.singular?
# => true
m = Matrix[[0, 1], [0, 1]]
m.singular?
# => false
Returns true if this is a singular matrix.
m = Matrix[[1, 2], [2, 4]]
m.singular?
# => true
m = Matrix[[1, 2], [3, 4]]
m.singular?
# => false
Alias for: antisymmetric?
Returns true if this is a square matrix.
m = Matrix[[1, 2], [3, 4]]
m.square?
# => true
m = Matrix[[1, 2], [3, 4], [5, 6]]
m.square?
# => false
Returns true if this is a symmetric matrix. Raises an error if matrix is not square.
m = Matrix[
[1, 2, 3],
[2, 4, 5]
[3, 5, 6]]
m.symmetric?
# => true
Returns true if this is a unitary matrix. Raises an error if matrix is not square.
Remember that our matrix does not support complex numbers!
m = Matrix[[0, 1], [1, 0]]
m.unitary?
# => true
Returns true if this is a matrix with only zero elements.
m = Matrix[[0, 0], [0, 0]]
m.zero?
# => true
Always return true. Implemented just for compatibility with standard matrix.