sqfa.linalg
Utility functions for matrix algebra.
Functions
|
Conjugate matrix A by B, i.e. compute B A B^T. |
|
Compute the generalized eigenvalues of the pair of symmetric positive definite matrices (A, B). |
|
Compute the generalized eigenvectors of the pair of symmetric positive definite matrices (A, B). |
|
For symmetric positive definite matrix M, compute the inverse square root of M. |
|
Compute the matrix logarithm of a symmetric positive definite matrix. |
|
Compute the square root of a symmetric positive definite matrix. |
- sqfa.linalg.conjugate_matrix(A, B)
Conjugate matrix A by B, i.e. compute B A B^T.
- Parameters:
A (torch.Tensor) – Matrix A. Shape (n_batch_A, n_dim, n_dim).
B (torch.Tensor) – Matrix B. Shape (n_batch_B, n_dim, n_out).
- Returns:
C – The conjugated matrix. Shape (n_batch_A, n_batch_B, n_out, n_out). If a batch dimension is 1, it is squeezed out.
- Return type:
torch.Tensor
- sqfa.linalg.generalized_eigenvalues(A, B)
Compute the generalized eigenvalues of the pair of symmetric positive definite matrices (A, B).
- Parameters:
A (torch.Tensor) – Symmetric positive definite matrix. Shape (n_batch_A, n_dim, n_dim).
B (torch.Tensor) – Symmetric positive definite matrix. Shape (n_batch_B, n_dim, n_dim).
- Returns:
eigenvalues – The generalized eigenvalues of the pair (A, B), sorted in descending order. Shape (n_batch_A, n_batch_B, n_dim). If a batch dimension is 1, it is squeezed out.
- Return type:
torch.Tensor
- sqfa.linalg.generalized_eigenvectors(A, B)
Compute the generalized eigenvectors of the pair of symmetric positive definite matrices (A, B).
- Parameters:
A (torch.Tensor) – Symmetric positive definite matrix. Shape (n_batch_A, n_dim, n_dim).
B (torch.Tensor) – Symmetric positive definite matrix. Shape (n_batch_B, n_dim, n_dim).
- Returns:
eigenvectors (torch.Tensor) – The generalized eigenvectors sorted in descending order of the eigenvalues. Shape (n_batch_A, n_batch_B, n_dim, n_dim). If a batch dimension is 1, it is squeezed out.
eigenvalues (torch.Tensor) – The generalized eigenvalues sorted in descending order. Shape (n_batch_A, n_batch_B, n_dim). If a batch dimension is 1, it is squeezed out.
- sqfa.linalg.spd_inv_sqrt(M)
For symmetric positive definite matrix M, compute the inverse square root of M.
- Parameters:
M (torch.Tensor) – Symmetric positive definite matrices. Shape (n_batch, n_dim, n_dim).
- Returns:
M_inv_sqrt – Inverse square root of M. Shape (n_batch, n_dim, n_dim).
- Return type:
torch.Tensor
- sqfa.linalg.spd_log(M)
Compute the matrix logarithm of a symmetric positive definite matrix.
- Parameters:
M (torch.Tensor) – Symmetric positive definite matrices. Shape (…, n_dim, n_dim).
- Returns:
M_log – The matrix logarithm of M. Shape (…, n_dim, n_dim).
- Return type:
torch.Tensor
- sqfa.linalg.spd_sqrt(M)
Compute the square root of a symmetric positive definite matrix.
Computes the symmetric positive definite matrix S such that SS = M.
- Parameters:
M (torch.Tensor) – Symmetric positive definite matrices. Shape (…, n_dim, n_dim).
- Returns:
M_sqrt – The square root of M. Shape (…, n_dim, n_dim).
- Return type:
torch.Tensor