rsLQR
0.1
|
Simple linear algebra routines. More...
#include "matrix.h"
Go to the source code of this file.
int | clap_MatrixAddition (Matrix *A, Matrix *B, double alpha) |
Add two matrices of the same size, storing the result in B . More... | |
int | clap_MatrixScale (Matrix *A, double alpha) |
Scale a matrix by a constant. More... | |
int | clap_MatrixMultiply (Matrix *A, Matrix *B, Matrix *C, bool tA, bool tB, double alpha, double beta) |
Matrix multiplication. More... | |
int | clap_MatrixTransposeMultiply (Matrix *A, Matrix *B, Matrix *C) |
A shortcut to perform transposed matrix multiplication. More... | |
int | clap_SymmetricMatrixMultiply (Matrix *Asym, Matrix *B, Matrix *C, double alpha, double beta) |
Matrix multiplication with a symmetric matrix A. More... | |
int | clap_AddDiagonal (Matrix *A, double alpha) |
Add a constant value to the diagonal of a matrix. More... | |
int | clap_CholeskyFactorize (Matrix *A) |
Perform a Cholesky decomposition. More... | |
int | clap_CholeskySolve (Matrix *A, Matrix *b) |
Solve a linear system of equation with a precomputed Cholesky decomposition. More... | |
int | clap_LowerTriBackSub (Matrix *L, Matrix *b, bool istransposed) |
Solve a linear system of equation for a lower triangular matrix. More... | |
Simple linear algebra routines.
int clap_AddDiagonal | ( | Matrix * | A, |
double | alpha | ||
) |
Add a constant value to the diagonal of a matrix.
[in,out] | A | a matrix of size (n,m) where n <= m |
[in] | alpha | scalar to add to the diagonal |
int clap_CholeskyFactorize | ( | Matrix * | A | ) |
Perform a Cholesky decomposition.
Performs a Cholesky decomposition on the square matrix A
, storing the result in the lower triangular portion of A
.
A | a square symmetric matrix |
Solve a linear system of equation with a precomputed Cholesky decomposition.
[in] | A | A square matrix whose Cholesky decomposition is stored in the lower triangular portion of the matrix |
[in,out] | b | The right-hand-side vector. Stores the solution upon completion of the function. |
Solve a linear system of equation for a lower triangular matrix.
Uses backsubstitution to solve a system of equations of the following form:
\[ L x = b \]
for a lower-triangular matrix \( L \), or
\[ L^T x = b \]
if istransposed
is true.
[in] | L | A lower-triangular matrix |
[in,out] | b | The right-hand-side vector. Stores the solution upon completion. |
istransposed | Should L be transposed when solving the system of equations. |
Add two matrices of the same size, storing the result in B
.
Performs the following operation:
\[ B = B + \alpha A \]
[in] | A | any matrix of size (m,n) |
[in,out] | B | any matrix of size (m,n) |
[in] | alpha | scalar factor on A |
int clap_MatrixMultiply | ( | Matrix * | A, |
Matrix * | B, | ||
Matrix * | C, | ||
bool | tA, | ||
bool | tB, | ||
double | alpha, | ||
double | beta | ||
) |
Matrix multiplication.
\[ C = \alpha A B + \beta C \]
int clap_MatrixScale | ( | Matrix * | A, |
double | alpha | ||
) |
Scale a matrix by a constant.
A | any matrix of non-zero size |
alpha | scalar multiplier |
A shortcut to perform transposed matrix multiplication.
Calculates
\[ C = A^T B \]
[in] | A | any matrix of size (n,m) |
[in] | B | any matrix of size (n,p) |
[out] | C | any matrix of size (m,p) |
int clap_SymmetricMatrixMultiply | ( | Matrix * | Asym, |
Matrix * | B, | ||
Matrix * | C, | ||
double | alpha, | ||
double | beta | ||
) |
Matrix multiplication with a symmetric matrix A.
Perform the following computation
\[ C = \alpha A B + \beta C \]
For a symmetric matrix \( A \).
[in] | Asym | |
[in] | B | |
[in,out] | C | |
[in] | alpha | |
[in] | beta |