![]() |
FancySafeBot 0.0.1
A safe robotics library
|
Linear algebra utility for matrix and vector computations. More...
Typedefs | |
typedef double | double_t |
Floating point type. | |
typedef enum FsbLapackErrorType | FsbLinalgErrorType |
Error codes for linear algebra functions. | |
Enumerations | |
enum | FsbLapackErrorType { EFSB_LAPACK_ERROR_NONE = 0 , EFSB_LAPACK_ERROR_INPUT , EFSB_LAPACK_ERROR_MEMORY , EFSB_LAPACK_ERROR_CONVERGE , EFSB_LAPACK_ERROR_QUERY , EFSB_LAPACK_NOT_POSITIVE_DEFINITE , EFSB_LAPACK_SINGULAR } |
Error codes for linear algebra functions. More... | |
Functions | |
FsbLinalgErrorType | fsb_linalg_svd (const double_t mat[], size_t rows, size_t cols, bool u_full, bool v_full, size_t work_len, double_t work[], double_t unitary_u[], double_t sing_val[], double_t unitary_vt[]) |
SVD decomposition. | |
FsbLinalgErrorType | fsb_linalg_matrix_eig (const double_t mat[], size_t dim, size_t work_len, double_t work[], double_t val_real[], double_t val_imag[], double_t vec_real[], double_t vec_imag[]) |
Eigenvalue decomposition. | |
FsbLinalgErrorType | fsb_linalg_sym_lt_eig (const double_t mat[], size_t dim, size_t work_len, double_t work[], double_t val[], double_t vec[]) |
Eigenvalue decomposition for symmetric lower triangular matrix. | |
FsbLinalgErrorType | fsb_linalg_cholesky_decomposition (const double_t mat[], size_t dim, double_t mat_chol[]) |
Cholesky factorization for symmetric positive definite matrix. | |
FsbLinalgErrorType | fsb_linalg_cholesky_solve (const double_t mat[], const double_t b_vec[], size_t nrhs, size_t dim, size_t work_len, double_t work[], double_t x_vec[]) |
Cholesky solve. | |
bool | fsb_linalg_is_posdef (const double_t mat[], size_t dim, size_t work_len, double_t work[]) |
Check if lower triangular symmetric matrix is positive definite. | |
FsbLinalgErrorType | fsb_linalg_matrix_sqr_solve (const double_t mat[], const double_t y_vec[], size_t nrhs, size_t dim, size_t work_len, size_t iwork_len, double_t work[], int iwork[], double_t x_vec[]) |
Linear algebra utility for matrix and vector computations.
enum FsbLapackErrorType |
Error codes for linear algebra functions.
FsbLinalgErrorType fsb_linalg_cholesky_decomposition | ( | const double_t | mat[], |
size_t | dim, | ||
double_t | mat_chol[] | ||
) |
Cholesky factorization for symmetric positive definite matrix.
mat | Input matrix (dim x dim) |
dim | Matrix A dimension s |
mat_chol | Cholesky factorization of input matrix A (dim x dim) |
FsbLinalgErrorType fsb_linalg_cholesky_solve | ( | const double_t | mat[], |
const double_t | b_vec[], | ||
size_t | nrhs, | ||
size_t | dim, | ||
size_t | work_len, | ||
double_t | work[], | ||
double_t | x_vec[] | ||
) |
Cholesky solve.
square symmetric positive-definite matrix cholesky solve. solve for b from x = A b Variable x is overwritten by b on exit
mat | |
b_vec | |
nrhs | |
dim | |
work_len | |
work | |
x_vec |
Check if lower triangular symmetric matrix is positive definite.
mat | Input lower triangular matrix (sxs) |
dim | Matrix A dimension |
work_len | Work vector length |
work | Work vector |
FsbLinalgErrorType fsb_linalg_matrix_eig | ( | const double_t | mat[], |
size_t | dim, | ||
size_t | work_len, | ||
double_t | work[], | ||
double_t | val_real[], | ||
double_t | val_imag[], | ||
double_t | vec_real[], | ||
double_t | vec_imag[] | ||
) |
Eigenvalue decomposition.
[in] | mat | input matrix (sxs) |
[in] | dim | matrix A dimension |
[in] | work_len | buffer |
[in,out] | work | buffer |
[out] | val_real | real components of the eigenvalues (sx1) |
[out] | val_imag | imaginary components of the eigenvalues (sx1) |
[out] | vec_real | real components of the eigenvectors (sxs) |
[out] | vec_imag | imaginary components of the eigenvectors (sxs) |
FsbLinalgErrorType fsb_linalg_matrix_sqr_solve | ( | const double_t | mat[], |
const double_t | y_vec[], | ||
size_t | nrhs, | ||
size_t | dim, | ||
size_t | work_len, | ||
size_t | iwork_len, | ||
double_t | work[], | ||
int | iwork[], | ||
double_t | x_vec[] | ||
) |
@biref Solve linear system of equations with a square matrix
mat | Matrix to solve (dim x dim) |
y_vec | Right-hand side vector (dim x nrhs) |
nrhs | Number of right-hand side vectors |
dim | Matrix A dimension (s) |
work_len | Work vector length |
iwork_len | Integer work vector length |
work | Work vector |
iwork | Integer work vector |
x_vec | Output Solution vector (dim x nrhs) |
FsbLinalgErrorType fsb_linalg_svd | ( | const double_t | mat[], |
size_t | rows, | ||
size_t | cols, | ||
bool | u_full, | ||
bool | v_full, | ||
size_t | work_len, | ||
double_t | work[], | ||
double_t | unitary_u[], | ||
double_t | sing_val[], | ||
double_t | unitary_vt[] | ||
) |
SVD decomposition.
u_full and v_full affect the output matrices as follows: if (m < n) then s = m else s = n if (u_full, v_full) == (0, 0) then U(m,s), S(s,s), VT(s,n) if (u_full, v_full) == (1, 0) then U(m,m), S(m,s), VT(s,n) if (u_full, v_full) == (0, 1) then U(m,s), S(s,n), VT(n,n) if (u_full, v_full) == (1, 1) then U(m,m), S(m,n), VT(n,n)
[in] | mat | matrix to perform SVD |
[in] | rows | rows of A |
[in] | cols | columns of A |
[in] | u_full | Boolean for full U matrix |
[in] | v_full | Boolean for full V matrix |
[in] | work_len | buffer |
[in,out] | work | buffer |
[out] | unitary_u | Unitary matrix U (m x m) |
[out] | sing_val | Singular values array S (s x 1) |
[out] | unitary_vt | Transpose of unitary matrix V (n x n) |
FsbLinalgErrorType fsb_linalg_sym_lt_eig | ( | const double_t | mat[], |
size_t | dim, | ||
size_t | work_len, | ||
double_t | work[], | ||
double_t | val[], | ||
double_t | vec[] | ||
) |
Eigenvalue decomposition for symmetric lower triangular matrix.
[in] | mat | input matrix (sxs) |
[in] | dim | matrix A dimension |
[in] | work_len | buffer |
[in,out] | work | buffer |
[out] | val | eigenvalues (sx1) |
[out] | vec | column eigenvectors (sxs) |