FancySafeBot 0.0.1
A safe robotics library
Loading...
Searching...
No Matches
Linear Algebra

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[])
 

Detailed Description

Linear algebra utility for matrix and vector computations.

Enumeration Type Documentation

◆ FsbLapackErrorType

Error codes for linear algebra functions.

Enumerator
EFSB_LAPACK_ERROR_NONE 

No error.

EFSB_LAPACK_ERROR_INPUT 

Input value error.

EFSB_LAPACK_ERROR_MEMORY 

Not enough memory.

EFSB_LAPACK_ERROR_CONVERGE 

Solution did not converge.

EFSB_LAPACK_ERROR_QUERY 

Work query failed.

EFSB_LAPACK_NOT_POSITIVE_DEFINITE 

Matrix not positive definite.

EFSB_LAPACK_SINGULAR 

Input matrix is singular.

Function Documentation

◆ fsb_linalg_cholesky_decomposition()

FsbLinalgErrorType fsb_linalg_cholesky_decomposition ( const double_t  mat[],
size_t  dim,
double_t  mat_chol[] 
)

Cholesky factorization for symmetric positive definite matrix.

Parameters
matInput matrix (dim x dim)
dimMatrix A dimension s
mat_cholCholesky factorization of input matrix A (dim x dim)
Returns
Error code

◆ fsb_linalg_cholesky_solve()

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

Parameters
mat
b_vec
nrhs
dim
work_len
work
x_vec
Returns

◆ fsb_linalg_is_posdef()

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.

Parameters
matInput lower triangular matrix (sxs)
dimMatrix A dimension
work_lenWork vector length
workWork vector
Returns
true
false

◆ fsb_linalg_matrix_eig()

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.

Parameters
[in]matinput matrix (sxs)
[in]dimmatrix A dimension
[in]work_lenbuffer
[in,out]workbuffer
[out]val_realreal components of the eigenvalues (sx1)
[out]val_imagimaginary components of the eigenvalues (sx1)
[out]vec_realreal components of the eigenvectors (sxs)
[out]vec_imagimaginary components of the eigenvectors (sxs)
Returns
error code

◆ fsb_linalg_matrix_sqr_solve()

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

Parameters
matMatrix to solve (dim x dim)
y_vecRight-hand side vector (dim x nrhs)
nrhsNumber of right-hand side vectors
dimMatrix A dimension (s)
work_lenWork vector length
iwork_lenInteger work vector length
workWork vector
iworkInteger work vector
x_vecOutput Solution vector (dim x nrhs)
Returns
Error code

◆ fsb_linalg_svd()

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)

Parameters
[in]matmatrix to perform SVD
[in]rowsrows of A
[in]colscolumns of A
[in]u_fullBoolean for full U matrix
[in]v_fullBoolean for full V matrix
[in]work_lenbuffer
[in,out]workbuffer
[out]unitary_uUnitary matrix U (m x m)
[out]sing_valSingular values array S (s x 1)
[out]unitary_vtTranspose of unitary matrix V (n x n)

◆ fsb_linalg_sym_lt_eig()

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.

Parameters
[in]matinput matrix (sxs)
[in]dimmatrix A dimension
[in]work_lenbuffer
[in,out]workbuffer
[out]valeigenvalues (sx1)
[out]veccolumn eigenvectors (sxs)