chombo-discharge
|
Namespace containing various useful linear algebra routines using LaPACK. More...
Functions | |
int | linearIndex (const int irow, const int jcol, const int M, const int N) |
Get the index in the linearized matrix of size MxN. | |
bool | computeSVD (std::vector< double > &a_linU, std::vector< double > &a_linSigma, std::vector< double > &a_linVtran, const std::vector< double > &a_linA, const int &a_M, const int &a_N) |
Compute the singular value decomposition of a matrix. | |
bool | computeSVD (std::vector< float > &a_linU, std::vector< float > &a_linSigma, std::vector< float > &a_linVtran, const std::vector< float > &a_linA, const int &a_M, const int &a_N) |
Compute the singular value decomposition of a matrix. | |
bool | computePseudoInverse (std::vector< double > &a_linAplus, const std::vector< double > &a_linA, const int &a_M, const int &a_N) |
Compute the pseudoinverse of matrix through singular value decomposition. | |
bool | computePseudoInverse (std::vector< float > &a_linAplus, const std::vector< float > &a_linA, const int &a_M, const int &a_N) |
Compute the pseudoinverse of matrix through singular value decomposition. | |
void | linearizeMatrix (std::vector< double > &a_linA, int &a_M, int &a_N, const std::vector< std::vector< double > > &a_A, const char &a_format) |
Linearize a matrix to column major Fortran form by assuming row or major colum format of the input matrix. | |
void | linearizeColumnMajorMatrix (std::vector< double > &a_linA, int &a_M, int &a_N, const std::vector< std::vector< double > > &a_A) |
Linearize a matrix to column major Fortran form by column major format of the input matrix. | |
void | linearizeRowMajorMatrix (std::vector< double > &a_linA, int &a_M, int &a_N, const std::vector< std::vector< double > > &a_A) |
Linearize a matrix to column major Fortran form by row major format of the input matrix. | |
void | deLinearizeMatrix (std::vector< std::vector< double > > &a_A, const int &a_M, const int &a_N, const std::vector< double > &a_linA, const char &a_format) |
Delinearize a linearized matrix from column major Fortran to row or major colum matrix format. | |
void | deLinearizeColumnMajorMatrix (std::vector< std::vector< double > > &a_A, const int &a_M, const int &a_N, const std::vector< double > &a_linA) |
Delinearize a linearized matrix from column major Fortran to column major form. | |
void | deLinearizeRowMajorMatrix (std::vector< std::vector< double > > &a_A, const int &a_M, const int &a_N, const std::vector< double > &a_linA) |
Delinearize a linearized matrix from column major Fortran to row major form. | |
Namespace containing various useful linear algebra routines using LaPACK.
bool LaPackUtils::computePseudoInverse | ( | std::vector< double > & | a_linAplus, |
const std::vector< double > & | a_linA, | ||
const int & | a_M, | ||
const int & | a_N | ||
) |
Compute the pseudoinverse of matrix through singular value decomposition.
[out] | a_linAplus | Pseudoinverse in column major Fortran order. |
[in] | a_linA | Input matrix in column major Fortran order |
[in] | a_M | Number of rows in A |
[in] | a_N | Number of colums in A |
bool LaPackUtils::computePseudoInverse | ( | std::vector< float > & | a_linAplus, |
const std::vector< float > & | a_linA, | ||
const int & | a_M, | ||
const int & | a_N | ||
) |
Compute the pseudoinverse of matrix through singular value decomposition.
[out] | a_linAplus | Pseudoinverse in column major Fortran order. |
[in] | a_linA | Input matrix in column major Fortran order |
[in] | a_M | Number of rows in A |
[in] | a_N | Number of colums in A |
bool LaPackUtils::computeSVD | ( | std::vector< double > & | a_linU, |
std::vector< double > & | a_linSigma, | ||
std::vector< double > & | a_linVtran, | ||
const std::vector< double > & | a_linA, | ||
const int & | a_M, | ||
const int & | a_N | ||
) |
Compute the singular value decomposition of a matrix.
[out] | a_linU | \(U\)-matrix. Linearized in column major Fortran order. |
[out] | a_linSigma | \(\Sigma\)-matrix. Linearized in column major Fortran order. |
[out] | a_linVtran | \(V^\intercal\)-matrix. Linearized in column major Fortran order. |
[in] | a_linA | \(A\)-matrix. Stored in column-major Fortran form |
[in] | a_M | Number of rows in A |
[in] | a_N | Number of columns in A |
This routine will compute the singular value decomposition of the input matrix \(A\) in the form
\[ A = U\Sigma V^\intercal. \]
The input and output matrices are assumed to be stored column-major so that a_A[0] is the first column of \(A\).
bool LaPackUtils::computeSVD | ( | std::vector< float > & | a_linU, |
std::vector< float > & | a_linSigma, | ||
std::vector< float > & | a_linVtran, | ||
const std::vector< float > & | a_linA, | ||
const int & | a_M, | ||
const int & | a_N | ||
) |
Compute the singular value decomposition of a matrix.
[out] | a_linU | \(U\)-matrix. Linearized in column major Fortran order. |
[out] | a_linSigma | \(\Sigma\)-matrix. Linearized in column major Fortran order. |
[out] | a_linVtran | \(V^\intercal\)-matrix. Linearized in column major Fortran order. |
[in] | a_linA | \(A\)-matrix. Stored in column-major Fortran form |
[in] | a_M | Number of rows in A |
[in] | a_N | Number of columns in A |
This routine will compute the singular value decomposition of the input matrix \(A\) in the form
\[ A = U\Sigma V^\intercal. \]
The input and output matrices are assumed to be stored column-major so that a_A[0] is the first column of \(A\).
void LaPackUtils::deLinearizeColumnMajorMatrix | ( | std::vector< std::vector< double > > & | a_A, |
const int & | a_M, | ||
const int & | a_N, | ||
const std::vector< double > & | a_linA | ||
) |
Delinearize a linearized matrix from column major Fortran to column major form.
[out] | a_A | Output matrix |
[in] | a_M | Number of rows |
[in] | a_N | Number of columns |
[in] | a_linA | Linearized matrix |
void LaPackUtils::deLinearizeMatrix | ( | std::vector< std::vector< double > > & | a_A, |
const int & | a_M, | ||
const int & | a_N, | ||
const std::vector< double > & | a_linA, | ||
const char & | a_format | ||
) |
Delinearize a linearized matrix from column major Fortran to row or major colum matrix format.
[out] | a_A | Output matrix |
[in] | a_M | Number of rows |
[in] | a_N | Number of columns |
[in] | a_linA | Linearized matrix |
[in] | a_format | Format of input matrix, either 'C' or 'R'. If 'C', then a_A[0] is the first column of the matrix. Likewise, if 'R' then a_A[0] is the first row of the matrix. |
void LaPackUtils::deLinearizeRowMajorMatrix | ( | std::vector< std::vector< double > > & | a_A, |
const int & | a_M, | ||
const int & | a_N, | ||
const std::vector< double > & | a_linA | ||
) |
Delinearize a linearized matrix from column major Fortran to row major form.
[out] | a_A | Output matrix |
[in] | a_M | Number of rows |
[in] | a_N | Number of columns |
[in] | a_linA | Linearized matrix |
Get the index in the linearized matrix of size MxN.
[in] | irow | The row number |
[in] | jcol | The column number |
[in] | M | Number of rows |
[in] | N | Number columns |
void LaPackUtils::linearizeColumnMajorMatrix | ( | std::vector< double > & | a_linA, |
int & | a_M, | ||
int & | a_N, | ||
const std::vector< std::vector< double > > & | a_A | ||
) |
Linearize a matrix to column major Fortran form by column major format of the input matrix.
[out] | a_linA | Linearized matrix |
[out] | a_M | Number of rows |
[out] | a_N | Number of columns |
[in] | a_A | Input matrix |
void LaPackUtils::linearizeMatrix | ( | std::vector< double > & | a_linA, |
int & | a_M, | ||
int & | a_N, | ||
const std::vector< std::vector< double > > & | a_A, | ||
const char & | a_format | ||
) |
Linearize a matrix to column major Fortran form by assuming row or major colum format of the input matrix.
[out] | a_linA | Linearized matrix |
[out] | a_M | Number of rows |
[out] | a_N | Number of columns |
[in] | a_A | Input matrix |
[in] | a_format | Format of input matrix, either 'C' or 'R'. If 'C', then a_A[0] is the first column of the matrix. Likewise, if 'R' then a_A[0] is the first row of the matrix. |
void LaPackUtils::linearizeRowMajorMatrix | ( | std::vector< double > & | a_linA, |
int & | a_M, | ||
int & | a_N, | ||
const std::vector< std::vector< double > > & | a_A | ||
) |
Linearize a matrix to column major Fortran form by row major format of the input matrix.
[out] | a_linA | Linearized matrix |
[out] | a_M | Number of rows |
[out] | a_N | Number of columns |
[in] | a_A | Input matrix |