Skip to content

Matrix methods

Sergey Duyunov edited this page Nov 18, 2019 · 8 revisions
Constructors
::new Creates a random number matrix of a given size
::build Creates a matrix by applying a block
::I Alias for: identity
::identity Creates an identity matrix
::[] Creates a matrix where each argument is a row
::column_vector
::columns
::combine
::diagonal
::empty
::hstack
::row_vector
::rows
::scalar
::unit
::vstack
::zero
Algebra
#* Matrix multiplication
#** Matrix exponentiation
#+ Matrix addition
#+@ Unary plus
#add! Addition with a given matrix
#- Matrix subtraction
#-@ Unary minus
#sub! Subtraction from a given matrix.
#/ Matrix division (multiplication by the inverse)
#adjugate Returns the adjugate of the matrix.
#abs Absolute value of each element.
#cofactor Multiplying the first minor by (-1)**(row + column)
#determinant Determinant of the matrix
#det Alias for: determinant
#laplace_expansion Equivalent to the determinant method
#cofactor_expansion Alias for: laplace_expansion
#conjugate Returns the matrix unchanged
#conj Alias for: conjugate
#hadamard_product Hadamard product
#entrywise_product Alias for: hadamard_product
#first_minor Deletes given row and column
#inverse Returns the inverse of the matrix.
#inv Alias for: inverse
#rank Returns the rank of the matrix
#round Rounds each element
#transpose Creates a new matrix by transposing
#t Alias for: transpose
#trace Sum of diagonal elements
#tr Alias for: trace
#imaginary Returns a zero-matrix of the same size
#imag Alias for: imaginary
#real Returns the matrix unchanged
#rect Returns the real and imaginary parts of the matrix.
#rectangular Alias for: rect
Comparators
#eql? Checking matrices for equality
#== Checking matrices for equality
#>= Check for greater than or equa
#<= Check for less than or equa
#> Check for greater
#< Check for less
Predicates
#antisymmetric? Checks the matrix for antisymmetry
#diagonal? Checks the diagonality of the matrix
#empty? Check the matrix for emptiness
#hermitian? Alias for: symmetric?
#lower_triangular? Check the matrix for lower triangularity
#upper_triangular? Check the matrix for upper triangularity
#normal? Checking the normality of the matrix
#orthogonal? Checking the matrix for orthogonality
#permutation? Checks if the matrix is a permutation matrix
#regular? Checking whether the matrix is regular
#singular? Checking whether the matrix is singular
#skew_symmetric? Alias for: antisymmetric?
#square? Check if the matrix is square
#symmetric? Check if the matrix is symmetric
#unitary? Check if the matrix is unitary
#zero? Check if the matrix is zero-matrix
#real? Always return true