Functions | |
void | a_real_T1 (a_uint n, a_real *A) |
transpose an n x n square matrix in-place. | |
void | a_real_T2 (a_uint m, a_uint n, a_real const *__restrict A, a_real *__restrict T) |
transpose a given m x n matrix A into an n x m matrix T. | |
void | a_real_mulmm (a_uint row, a_uint c_r, a_uint col, a_real const *__restrict X, a_real const *__restrict Y, a_real *__restrict Z) |
multiply two matrices X and Y, storing the result in Z. | |
void | a_real_mulTm (a_uint c_r, a_uint row, a_uint col, a_real const *__restrict X, a_real const *__restrict Y, a_real *__restrict Z) |
multiply the transpose of matrix X with matrix Y, storing the result in Z. | |
void | a_real_mulmT (a_uint row, a_uint col, a_uint c_r, a_real const *__restrict X, a_real const *__restrict Y, a_real *__restrict Z) |
multiply matrix X with the transpose of matrix Y, storing the result in Z. | |
void | a_real_mulTT (a_uint row, a_uint c_r, a_uint col, a_real const *__restrict X, a_real const *__restrict Y, a_real *__restrict Z) |
multiply the transpose of matrix X with the transpose of matrix Y, storing the result in Z. | |
int | a_real_plu (a_uint n, a_real *A, a_uint *p, int *sign) |
compute LU decomposition of a square matrix with partial pivoting. | |
void | a_real_plu_P (a_uint n, a_uint const *p, a_real *P) |
construct the permutation matrix P from a permutation vector p. | |
void | a_real_plu_P_ (a_uint n, a_uint const *p, a_real *P) |
void | a_real_plu_L (a_uint n, a_real const *A, a_real *L) |
extract the lower triangular matrix L from matrix A. | |
void | a_real_plu_U (a_uint n, a_real const *A, a_real *U) |
extract the upper triangular matrix U from matrix A. | |
void | a_real_plu_apply (a_uint n, a_uint const *p, a_real const *b, a_real *Pb) |
apply the permutation P to the vector b, producing Pb. | |
void | a_real_plu_lower (a_uint n, a_real const *L, a_real *y) |
solve the lower triangular system Ly = Pb for y. | |
void | a_real_plu_lower_ (a_uint n, a_real const *L, a_real *y) |
void | a_real_plu_upper (a_uint n, a_real const *U, a_real *x) |
solve the upper triangular system Ux = y for x. | |
void | a_real_plu_upper_ (a_uint n, a_real const *U, a_real *x) |
void | a_real_plu_solve (a_uint n, a_real const *A, a_uint const *p, a_real const *b, a_real *x) |
solve the linear system Ax = b using LU decomposition with partial pivoting. | |
void | a_real_plu_inv (a_uint n, a_real const *A, a_uint const *p, a_real *b, a_real *I) |
compute the inverse of a matrix using its LU decomposition and permutation matrix. | |
void | a_real_plu_inv_ (a_uint n, a_real const *A, a_uint const *p, a_real *I) |
a_real | a_real_plu_det (a_uint n, a_real const *A, int sign) |
compute the determinant of a matrix using its LU decomposition. | |
a_real | a_real_plu_lndet (a_uint n, a_real const *A) |
compute the natural logarithm of the absolute value of the determinant of a matrix using its LU decomposition. | |
int | a_real_plu_sgndet (a_uint n, a_real const *A, int sign) |
compute the sign of the determinant of a matrix using its LU decomposition. | |
int | a_real_llt (a_uint n, a_real *A) |
compute Cholesky decomposition of a symmetric positive-definite matrix. | |
void | a_real_llt_L (a_uint n, a_real const *A, a_real *L) |
extract the lower triangular matrix L from matrix A. | |
void | a_real_llt_lower (a_uint n, a_real const *L, a_real *y) |
solve the lower triangular system Ly = b for y. | |
void | a_real_llt_lower_ (a_uint n, a_real const *L, a_real *y) |
void | a_real_llt_upper (a_uint n, a_real const *L, a_real *x) |
solve the upper triangular system L^T x = y for x. | |
void | a_real_llt_upper_ (a_uint n, a_real const *L, a_real *x) |
void | a_real_llt_solve (a_uint n, a_real const *A, a_real *x) |
solve the linear system Ax = b using the Cholesky factorization A = LL^T. | |
void | a_real_llt_inv (a_uint n, a_real const *A, a_real *b, a_real *I) |
compute the inverse of a matrix using its Cholesky factorization A = LL^T. | |
void | a_real_llt_inv_ (a_uint n, a_real const *A, a_real *I) |
a_real | a_real_llt_det (a_uint n, a_real const *A) |
compute the determinant of a matrix using its Cholesky decomposition. | |
a_real | a_real_llt_lndet (a_uint n, a_real const *A) |
compute the natural logarithm of the absolute value of the determinant of a matrix using its Cholesky decomposition. | |
compute Cholesky decomposition of a symmetric positive-definite matrix.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in,out] | A | an n x n square matrix. on input, contains the matrix to decompose. on output, contains the L matrix. |
-1 | on failure, A is a singular matrix. |
compute the determinant of a matrix using its Cholesky decomposition.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L form after Cholesky decomposition. |
compute the inverse of a matrix using its Cholesky factorization A = LL^T.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L form after Cholesky decomposition. |
[in] | b | a pre-allocated temporary buffer of size n for intermediate computations. |
[out] | I | the output matrix where the inverse of A will be stored. |
extract the lower triangular matrix L from matrix A.
[in] | n | the order of the square matrix that was decomposed. |
[in] | A | the matrix containing L form after Cholesky decomposition. |
[out] | L | the output matrix where the lower triangular matrix will be stored. |
compute the natural logarithm of the absolute value of the determinant of a matrix using its Cholesky decomposition.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L form after Cholesky decomposition. |
solve the lower triangular system Ly = b for y.
[in] | n | the order of the square matrix L (number of rows and columns). |
[in] | L | the lower triangular matrix L, stored in row-major order. |
[in,out] | y | on input, contains the vector b. on output, contains the solution vector y. |
solve the linear system Ax = b using the Cholesky factorization A = LL^T.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L form after Cholesky decomposition. |
[in,out] | x | on input, contains the vector b. on output, contains the solution vector x. |
solve the upper triangular system L^T x = y for x.
[in] | n | the order of the square matrix L (number of rows and columns). |
[in] | L | the lower triangular matrix L, stored in row-major order. |
[in,out] | x | on input, contains the vector y. on output, contains the solution vector x. |
void a_real_mulmm | ( | a_uint | row, |
a_uint | c_r, | ||
a_uint | col, | ||
a_real const *__restrict | X, | ||
a_real const *__restrict | Y, | ||
a_real *__restrict | Z ) |
multiply two matrices X and Y, storing the result in Z.
[in] | row | rows matrix Z and rows in matrix X. |
[in] | c_r | columns in matrix X and rows in matrix Y. |
[in] | col | columns in matrix Z and columns in matrix Y. |
[in] | X | the first input matrix. |
[in] | Y | the second input matrix. |
[out] | Z | the output matrix where the result will be stored. |
void a_real_mulmT | ( | a_uint | row, |
a_uint | col, | ||
a_uint | c_r, | ||
a_real const *__restrict | X, | ||
a_real const *__restrict | Y, | ||
a_real *__restrict | Z ) |
multiply matrix X with the transpose of matrix Y, storing the result in Z.
[in] | row | rows matrix Z and rows in matrix X. |
[in] | col | columns in matrix Z and rows in matrix Y. |
[in] | c_r | columns in matrix X and columns in matrix Y. |
[in] | X | the first input matrix. |
[in] | Y | the second input matrix that will be transposed during multiplication. |
[out] | Z | the output matrix where the result will be stored. |
void a_real_mulTm | ( | a_uint | c_r, |
a_uint | row, | ||
a_uint | col, | ||
a_real const *__restrict | X, | ||
a_real const *__restrict | Y, | ||
a_real *__restrict | Z ) |
multiply the transpose of matrix X with matrix Y, storing the result in Z.
[in] | c_r | rows in matrix X and rows in matrix Y. |
[in] | row | rows in matrix Z and columns in matrix X. |
[in] | col | columns in matrix Z and columns in matrix Y. |
[in] | X | the first input matrix that will be transposed during multiplication. |
[in] | Y | the second input matrix. |
[out] | Z | the output matrix where the result will be stored. |
void a_real_mulTT | ( | a_uint | row, |
a_uint | c_r, | ||
a_uint | col, | ||
a_real const *__restrict | X, | ||
a_real const *__restrict | Y, | ||
a_real *__restrict | Z ) |
multiply the transpose of matrix X with the transpose of matrix Y, storing the result in Z.
[in] | row | rows matrix Z and columns in matrix X. |
[in] | c_r | rows in matrix X and columns in matrix Y. |
[in] | col | columns in matrix Z and rows in matrix Y. |
[in] | X | the first input matrix that will be transposed during multiplication. |
[in] | Y | the second input matrix that will be transposed during multiplication. |
[out] | Z | the output matrix where the result will be stored. |
compute LU decomposition of a square matrix with partial pivoting.
This function performs an LU decomposition on the given square matrix A, where L is a lower triangular matrix, and U is an upper triangular matrix. Partial pivoting is used to improve numerical stability during the decomposition process. The result is stored in the original matrix A, with L stored below, and U stored in the diagonal and above. Additionally, it calculates a permutation matrix P that records the row exchanges made during partial pivoting, and determines the sign of the permutation (which can be used to find the determinant's sign).
[in] | n | the order of the square matrix A (number of rows and columns). |
[in,out] | A | an n x n square matrix. on input, contains the matrix to decompose. on output, contains the L and U matrices. |
[out] | p | the row permutation indices after partial pivoting. |
[out] | sign | store the sign of the permutation (+1 or -1). |
-1 | on failure, A is a singular matrix. |
apply the permutation P to the vector b, producing Pb.
[in] | n | the order of the square matrix that was decomposed. |
[in] | p | the row permutation indices after partial pivoting. |
[in] | b | the input vector of size n that will be permuted. |
[out] | Pb | the output vector where the permuted result will be stored. |
compute the determinant of a matrix using its LU decomposition.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L and U in a compact form after LU decomposition. |
[in] | sign | the sign of the permutation matrix P (+1 or -1). |
compute the inverse of a matrix using its LU decomposition and permutation matrix.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L and U in a compact form after LU decomposition. |
[in] | p | the permutation indices obtained during LU decomposition. |
[in] | b | a pre-allocated temporary buffer of size n for intermediate computations. |
[out] | I | the output matrix where the inverse of A will be stored. |
extract the lower triangular matrix L from matrix A.
[in] | n | the order of the square matrix that was decomposed. |
[in] | A | the matrix containing L and U in a compact form after LU decomposition. |
[out] | L | the output matrix where the lower triangular matrix will be stored. |
compute the natural logarithm of the absolute value of the determinant of a matrix using its LU decomposition.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L and U in a compact form after LU decomposition. |
solve the lower triangular system Ly = Pb for y.
[in] | n | the order of the square matrix L (number of rows and columns). |
[in] | L | the lower triangular matrix L, stored in row-major order. |
[in,out] | y | on input, contains the permuted vector Pb. on output, contains the solution vector y. |
construct the permutation matrix P from a permutation vector p.
[in] | n | the order of the square matrix that was decomposed. |
[in] | p | the row permutation indices after partial pivoting. |
[out] | P | the output matrix where the permutation matrix will be stored. |
compute the sign of the determinant of a matrix using its LU decomposition.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L and U in a compact form after LU decomposition. |
[in] | sign | the sign of the permutation matrix P (+1 or -1). |
void a_real_plu_solve | ( | a_uint | n, |
a_real const * | A, | ||
a_uint const * | p, | ||
a_real const * | b, | ||
a_real * | x ) |
solve the linear system Ax = b using LU decomposition with partial pivoting.
[in] | n | the order of the square matrix A (number of rows and columns). |
[in] | A | the matrix containing L and U in a compact form after LU decomposition. |
[in] | p | the permutation indices obtained during LU decomposition. |
[in] | b | the input vector b of the linear system. |
[out] | x | the output vector x where the solution will be stored. |
extract the upper triangular matrix U from matrix A.
[in] | n | the order of the square matrix that was decomposed. |
[in] | A | the matrix containing L and U in a compact form after LU decomposition. |
[out] | U | the output matrix where the upper triangular matrix will be stored. |
solve the upper triangular system Ux = y for x.
[in] | n | the order of the square matrix U (number of rows and columns). |
[in] | U | the upper triangular matrix U, stored in row-major order. |
[in,out] | x | on input, contains the vector y. on output, contains the solution vector x. |
transpose an n x n square matrix in-place.
[in] | n | order of square matrix A |
[in,out] | A | an n x n square matrix |
transpose a given m x n matrix A into an n x m matrix T.
[in] | m | rows in the input matrix A. |
[in] | n | columns in the input matrix A. |
[in] | A | the input matrix A (m x n), stored in row-major order. |
[out] | T | the output matrix where the transposed matrix T (n x m) will be stored. |