Linear Algebra

Linear Systems

Triangular Systems

solve_Lx_b(L, b)

Solves the system L x = b using back substitution

solve_LTx_b(L, b)

Solves the system L^T x = b using back substitution

solve_Ux_b(U, b)

Solves the system U x = b using back substitution

solve_UTx_b(U, b)

Solves the system U^T x = b using back substitution

solve_spd_chol(L, b)

Solves a symmetric positive definite system A x = b where A = L L’

Special Dense Linear Systems

mult_with_submatrix(A, columns, x)

Computes \(b = A[:, I] x\)

solve_on_submatrix(A, columns, b)

Solves the problem \(A[:, I] x = b\) where I is an index set of selected columns

Singular Value Decomposition

Fundamental Subspaces

orth(A[, rcond])

Constructs an orthonormal basis for the range of A using SVD

row_space(A[, rcond])

Constructs an orthonormal basis for the row space of A using SVD

null_space(A[, rcond])

Constructs an orthonormal basis for the null space of A using SVD

left_null_space(A[, rcond])

Constructs an orthonormal basis for the left null space of A using SVD

effective_rank(A[, rcond])

Returns the effective rank of A based on its singular value decomposition

effective_rank_from_svd(u, s, vh[, rcond])

Returns the effective rank of a matrix from its SVD

singular_values(A)

Returns the singular values of a matrix

SVD for Bidiagonal Matrices

bdsqr(alpha, beta, k)

Computes the SVD of the bidiagonal matrix

bdsqr_jit(alpha, beta, k)

Computes the SVD of the bidiagonal matrix

Truncated SVD

lansvd_simple(A, k, p0)

Returns the k largest singular values and corresponding vectors

lansvd_simple_jit(A, k, p0)

Returns the k largest singular values and corresponding vectors

lanbpro_init(A, k, p0, options)

Initialize the state with a starting vector

lanbpro_iteration(A, state, options)

One single (j-th) iteration of Lanczos bidiagonalization with partial reorthogonalization algorithm

lanbpro_iteration_jit(A, state, options)

One single (j-th) iteration of Lanczos bidiagonalization with partial reorthogonalization algorithm

lanbpro(A, k, p0)

K steps of the Lanczos bidiagonalization with partial reorthogonalization

lanbpro_jit(A, k, p0)

K steps of the Lanczos bidiagonalization with partial reorthogonalization

Orthogonalization

Householder Reflections

householder_vec(x)

Computes a Householder vector for \(x\)

householder_matrix(x)

Computes a Householder refection matrix for \(x\)

householder_premultiply(v, beta, A)

Pre-multiplies a Householder reflection defined by \(v, beta\) to a matrix A, PA

householder_postmultiply(v, beta, A)

Post-multiplies a Householder reflection defined by \(v, beta\) to a matrix A, AP

householder_ffm_jth_v_beta(A, j)

GVL4 EQ 5.1.4 v, beta calculation

householder_ffm_premultiply(A, C)

Computes Q^T C where Q is stored in its factored form in A.

householder_ffm_backward_accum(A, k)

Computes k columns of Q from the factored form representation of Q stored in A.

householder_ffm_to_wy(A)

Computes the WY representation of Q such that Q = I_m - W Y^T from the factored form representation

householder_qr_packed(A)

Computes the QR = A factorization of A using Householder reflections.

householder_split_qf_r(A)

Splits a packed QR factorization into QF and R

householder_qr(A)

Computes the QR = A factorization of A using Householder reflections

Subspaces

Projection

project_to_subspace(U, v)

Projects a vector to a subspace

is_in_subspace(U, v)

Checks whether a vector v is in the subspace spanned by an ONB U or not

Principal Angles

principal_angles_cos(A, B)

Returns the cosines of principal angles between two subspaces

principal_angles_rad(A, B)

Returns the principal angles between two subspaces in radians

principal_angles_deg(A, B)

Returns the principal angles between two subspaces in degrees

smallest_principal_angle_cos(A, B)

Returns the cosine of smallest principal angle between two subspaces

smallest_principal_angle_rad(A, B)

Returns the smallest principal angle between two subspaces in radians

smallest_principal_angle_deg(A, B)

Returns the smallest principal angle between two subspaces in degrees

smallest_principal_angles_cos(subspaces)

Returns the smallest principal angles between each pair of subspaces

smallest_principal_angles_rad(subspaces)

Returns the smallest principal angles between each pair of subspaces in radians

smallest_principal_angles_deg(subspaces)

Returns the smallest principal angles between each pair of subspaces in degrees

subspace_distance(A, B)

Returns the Grassmannian distance between two subspaces

Affine Spaces

Homogeneous Coordinate System

homogenize(X[, value])

homogenize_vec(x[, value])

homogenize_cols(X[, value])

Standard Matrices

Random matrices

gaussian_mtx(key, N, D[, normalize_atoms])

A dictionary/sensing matrix where entries are drawn independently from normal distribution.

Special Matrices

pascal(n[, symmetric])

Returns a pascal matrix of size n imes n

pascal_jit(n[, symmetric])

Returns a pascal matrix of size n imes n

Toeplitz Matrices

toeplitz_mat(c, r)

Constructs a Toeplitz matrix

toeplitz_mult(w, x)

Multiplies a Toeplitz matrix with a vector

Circulant Matrices

circulant_mat(c)

Constructs a circulant matrix

circulant_mult(c, x)

Multiplies a circulant matrix with a vector