Matrices

Predicates

is_matrix(A)

Checks if an array is a matrix

is_square(A)

Checks if an array is a square matrix

is_symmetric(A)

Checks if an array is a symmetric matrix

is_hermitian(A)

Checks if an array is a Hermitian matrix

is_positive_definite(A)

Checks if an array is a symmetric positive definite matrix

has_orthogonal_columns(A[, atol])

Checks if a matrix has orthogonal columns

has_orthogonal_rows(A[, atol])

Checks if a matrix has orthogonal rows

has_unitary_columns(A)

Checks if a matrix has unitary columns

has_unitary_rows(A)

Checks if a matrix has unitary rows

Matrix Multiplication

AH_v(A, v)

Returns \(A^H v\) for a given matrix A and a vector v

mat_transpose(x)

Returns the transpose of an array of matrices

mat_hermitian(a)

Returns the conjugate transpose of an array of matrices

diag_premultiply(d, A)

Compute D @ A where D is a diagonal matrix with entries from vector d

diag_postmultiply(A, d)

Compute A @ D where D is a diagonal matrix with entries from vector d

Matrix Parts

off_diagonal_elements(A)

Returns the off diagonal elements of a matrix A

off_diagonal_min(A)

Returns the minimum of the off diagonal elements

off_diagonal_max(A)

Returns the maximum of the off diagonal elements

off_diagonal_mean(A)

Returns the maximum of the off diagonal elements

block_diag(A, b)

Extracts the block diagonal from the given matrix

mat_column_blocks(A, n_blocks)

Splits the columns of a matrix into blocks and returns a 3D array

Matrix Operations

set_diagonal(A, value)

Sets the diagonal elements to a specific value

add_to_diagonal(A, value)

Add a specific value to the diagonal elements

Row wise and column wise norms

norms_l1_cw(X)

Computes the l_1 norm of each column of a matrix

norms_l1_rw(X)

Computes the l_1 norm of each row of a matrix

norms_l2_cw(X)

Computes the l_2 norm of each column of a matrix

norms_l2_rw(X)

Computes the l_2 norm of each row of a matrix

norms_linf_cw(X)

Computes the l_inf norm of each column of a matrix

norms_linf_rw(X)

Computes the l_inf norm of each row of a matrix

sqr_norms_l2_cw(X)

Computes the squared l_2 norm of each column of a matrix

sqr_norms_l2_rw(X)

Computes the l_2 norm of each row of a matrix

normalize_l1_cw(X)

Normalize each column of X per l_1-norm

normalize_l1_rw(X)

Normalize each row of X per l_1-norm

normalize_l2_cw(X)

Normalize each column of X per l_2-norm

normalize_l2_rw(X)

Normalize each row of X per l_2-norm

Pairwise Distances

pairwise_sqr_l2_distances_rw(A, B)

Computes the pairwise squared distances between points in A and points in B where each point is a row vector

pairwise_sqr_l2_distances_cw(A, B)

Computes the pairwise squared distances between points in A and points in B where each point is a column vector

pairwise_l2_distances_rw(A, B)

Computes the pairwise distances between points in A and points in B where each point is a row vector

pairwise_l2_distances_cw(A, B)

Computes the pairwise distances between points in A and points in B where each point is a column vector

pdist_sqr_l2_rw(A)

Computes the pairwise squared distances between points in A where each point is a row vector

pdist_sqr_l2_cw(A)

Computes the pairwise squared distances between points in A where each point is a column vector

pdist_l2_rw(A)

Computes the pairwise distances between points in A where ach point is a row vector

pdist_l2_cw(A)

Computes the pairwise distances between points in A where each point is a column vector

pairwise_l1_distances_rw(A, B)

Computes the pairwise city-block distances between points in A and points in B where each point is a row vector

pairwise_l1_distances_cw(A, B)

Computes the pairwise city-block distances between points in A and points in B where each point is a column vector

pdist_l1_rw(A)

Computes the pairwise city-block distances between points in A where each point is a row vector

pdist_l1_cw(A)

Computes the pairwise city-block distances between points in A where each point is a column vector

pairwise_linf_distances_rw(A, B)

Computes the pairwise Chebyshev distances between points in A and points in B where each point is a row vector

pairwise_linf_distances_cw(A, B)

Computes the pairwise Chebyshev distances between points in A and points in B where each point is a column vector

pdist_linf_rw(A)

Computes the pairwise Chebyshev distances between points in A where each point is a row vector

pdist_linf_cw(A)

Computes the pairwise Chebyshev distances between points in A where each point is a column vector