Chombo + EB
3.2
|
#include <LAPACKMatrix.H>
Public Member Functions | |
LAPACKMatrix (int a_nrow, int a_ncol) | |
main constructor. Matrix of Chombo Real type. values are unintitialized More... | |
void | define (int nrow, int ncol) |
LAPACKMatrix (int a_nrow, int a_ncol, Real *a_data) | |
alias constructor. Use a_data as m_data, does not delete it in destructor More... | |
LAPACKMatrix () | |
null constructor builds matrix with nullptr and size=[0,0] More... | |
LAPACKMatrix (const LAPACKMatrix &a_input) | |
deep copy constructor More... | |
LAPACKMatrix (LAPACKMatrix &&a_input) | |
move copy constructor More... | |
void | clear () |
Real | normLTwo () const |
return sqrt(sum of squares of all values) More... | |
void | setToIdentity () |
~LAPACKMatrix () | |
void | setVal (const Real &a_val) |
Real * | dataPtr () |
const Real * | dataPtr () const |
void | truncate (int a_nrow, int a_ncol) |
Real | maxNorm () const |
const Real & | operator() (int irow, int icol) const |
Real & | operator() (int irow, int icol) |
std::pair< int, int > | dims () const |
LAPACKMatrix & | operator= (const LAPACKMatrix &a_matrix) |
deep assign. More... | |
LAPACKMatrix & | operator= (LAPACKMatrix &&a_matrix) |
move assignment More... | |
LAPACKMatrix & | operator+= (const LAPACKMatrix &a_matrix) |
LAPACKMatrix & | operator-= (const LAPACKMatrix &a_matrix) |
LAPACKMatrix & | operator*= (const Real &a_scalingFactor) |
int | offset (int irow, int icol) const |
void | poutAll () const |
void | poutDiag () const |
void | poutDiagMatlab () const |
void | poutMatlab () const |
int | invert () |
inverts this matix More... | |
int | invertUsingSVD (int a_maxiter, Real a_tol) |
inverts this matrix using SVD More... | |
int | pseudoInvertUsingSVD (int a_maxiter, Real a_tol) |
int | pseudoInvertUsingQR () |
int | invertUsingLeastSquares () |
inverts this matrix using least squares More... | |
void | setSmallCellRow (const int &irow) |
void | transpose () |
void | checkConditionNumber () const |
void | checkUpperTriangularConditionNumber () const |
Static Public Attributes | |
static bool | s_checkConditionNumber |
turn on if you want every solve to check the condition number More... | |
static bool | s_verbose |
static bool | s_outputStenData |
Private Attributes | |
int | m_nrow |
int | m_ncol |
Real * | m_data |
bool | m_alias =false |
Friends | |
void | multiply (LAPACKMatrix &a_product, const LAPACKMatrix &a_left, const LAPACKMatrix &a_right) |
int | solveLeastSquares (LAPACKMatrix &A, LAPACKMatrix &B) |
below stuff is shamelessly stolen from lapackwrapper class More... | |
int | solveLeastSquaresTranspose (LAPACKMatrix &A, LAPACKMatrix &B) |
int | solveLSTSVD (LAPACKMatrix &A, LAPACKMatrix &B, int a_maxiter, Real a_tol) |
int | solveLSTSVD (LAPACKMatrix &X, const LAPACKMatrix &A, const LAPACKMatrix &B, int a_maxiter, Real a_tol) |
int | solveLSTSVDOnce (LAPACKMatrix &X, LAPACKMatrix &B) |
int | solveLSTSVDOnce (LAPACKMatrix &X, const LAPACKMatrix &A, const LAPACKMatrix &B) |
int | solveEqualityConstrainedLS (LAPACKMatrix &A, LAPACKMatrix &c, LAPACKMatrix &B, LAPACKMatrix &d, LAPACKMatrix &x) |
int | solveReducedRankLS (LAPACKMatrix &A, LAPACKMatrix &b) |
Real | getInverseOfConditionNumber (const LAPACKMatrix &A) |
Real | getInverseOfUpperTriangularConditionNumber (const LAPACKMatrix &A) |
Getting sick of writing the basics here over and over. Silly class but it will cut down on the typing.
|
inline |
main constructor. Matrix of Chombo Real type. values are unintitialized
|
inline |
alias constructor. Use a_data as m_data, does not delete it in destructor
|
inline |
null constructor builds matrix with nullptr and size=[0,0]
LAPACKMatrix::LAPACKMatrix | ( | const LAPACKMatrix & | a_input | ) |
deep copy constructor
|
inline |
move copy constructor
References m_data.
LAPACKMatrix::~LAPACKMatrix | ( | ) |
Referenced by clear().
|
inline |
|
inline |
References dataPtr(), define(), maxNorm(), normLTwo(), operator()(), setToIdentity(), setVal(), truncate(), and ~LAPACKMatrix().
Real LAPACKMatrix::normLTwo | ( | ) | const |
return sqrt(sum of squares of all values)
Referenced by clear().
void LAPACKMatrix::setToIdentity | ( | ) |
if(i==j) M=1 else M=0
Referenced by clear().
const Real* LAPACKMatrix::dataPtr | ( | ) | const |
void LAPACKMatrix::truncate | ( | int | a_nrow, |
int | a_ncol | ||
) |
make nrows = a_nrows etc. Useful when you want to discard the last few rows of the matrix.
Referenced by clear().
Real LAPACKMatrix::maxNorm | ( | ) | const |
Get the maximum absolute value of the matrix (for iterative solves)
Referenced by clear().
Real& LAPACKMatrix::operator() | ( | int | irow, |
int | icol | ||
) |
|
inline |
References m_ncol, m_nrow, and operator=().
LAPACKMatrix& LAPACKMatrix::operator= | ( | const LAPACKMatrix & | a_matrix | ) |
deep assign.
Referenced by dims().
|
inline |
move assignment
References invert(), invertUsingLeastSquares(), invertUsingSVD(), m_alias, m_data, m_ncol, m_nrow, offset(), operator*=(), operator+=(), operator-=(), poutAll(), poutDiag(), poutDiagMatlab(), poutMatlab(), pseudoInvertUsingQR(), and pseudoInvertUsingSVD().
LAPACKMatrix& LAPACKMatrix::operator+= | ( | const LAPACKMatrix & | a_matrix | ) |
Referenced by operator=().
LAPACKMatrix& LAPACKMatrix::operator-= | ( | const LAPACKMatrix & | a_matrix | ) |
Referenced by operator=().
LAPACKMatrix& LAPACKMatrix::operator*= | ( | const Real & | a_scalingFactor | ) |
Referenced by operator=().
int LAPACKMatrix::offset | ( | int | irow, |
int | icol | ||
) | const |
Referenced by operator=().
void LAPACKMatrix::poutAll | ( | ) | const |
Referenced by operator=().
void LAPACKMatrix::poutDiag | ( | ) | const |
Referenced by operator=().
void LAPACKMatrix::poutDiagMatlab | ( | ) | const |
Referenced by operator=().
void LAPACKMatrix::poutMatlab | ( | ) | const |
Referenced by operator=().
int LAPACKMatrix::invert | ( | ) |
inverts this matix
fails if matrix is not square if return value != 0, probably a singular matrix
Referenced by operator=().
int LAPACKMatrix::invertUsingSVD | ( | int | a_maxiter, |
Real | a_tol | ||
) |
inverts this matrix using SVD
Get Ainverse using least squares with svd if return value != 0, lapack was unhappy somehow
Referenced by operator=().
int LAPACKMatrix::pseudoInvertUsingSVD | ( | int | a_maxiter, |
Real | a_tol | ||
) |
Referenced by operator=().
int LAPACKMatrix::pseudoInvertUsingQR | ( | ) |
Referenced by operator=().
int LAPACKMatrix::invertUsingLeastSquares | ( | ) |
inverts this matrix using least squares
Get Ainverse using least squares with svd if return value != 0, lapack was unhappy somehow
Referenced by operator=().
|
inline |
References A, B, checkConditionNumber(), checkUpperTriangularConditionNumber(), getInverseOfConditionNumber, getInverseOfUpperTriangularConditionNumber, m_ncol, multiply, solveEqualityConstrainedLS, solveLeastSquares, solveLeastSquaresTranspose, solveLSTSVD, solveLSTSVDOnce, solveReducedRankLS, and transpose().
void LAPACKMatrix::transpose | ( | ) |
Referenced by setSmallCellRow().
void LAPACKMatrix::checkConditionNumber | ( | ) | const |
Referenced by setSmallCellRow().
void LAPACKMatrix::checkUpperTriangularConditionNumber | ( | ) | const |
Referenced by setSmallCellRow().
|
friend |
sets product = a_left* a_right fails if a_left.m_col != a_right.m_rows
Referenced by setSmallCellRow().
|
friend |
below stuff is shamelessly stolen from lapackwrapper class
Solves A*X = B using general least squares, for each column of B
Referenced by setSmallCellRow().
|
friend |
Solves A'*X = B using least squares, for vector b. Answer goes back into B I think
Solves A'*X = B using least squares, for vector b
Referenced by setSmallCellRow().
|
friend |
Solves A^T X = B using least squares with SVD, for vector b
Referenced by setSmallCellRow().
|
friend |
Solves A*X = B using least squares with SVD, for X
|
friend |
Referenced by setSmallCellRow().
|
friend |
Solves A*X = B using least squares with SVD, for X
|
friend |
Solves equality constrained least squares problem Find x, s.t. min norm(A x - c) with B x = d
Referenced by setSmallCellRow().
|
friend |
Solves A'*X = B using reduced rank least squares, for vector b
Referenced by setSmallCellRow().
|
friend |
Following Lapack, gets inverse of condition number. Returning a number near zero means the matrix is not really solvable.
Referenced by setSmallCellRow().
|
friend |
Referenced by setSmallCellRow().
|
static |
turn on if you want every solve to check the condition number
|
static |
|
static |
|
private |
Referenced by define(), dims(), and operator=().
|
private |
Referenced by define(), dims(), operator=(), and setSmallCellRow().
|
private |
Referenced by define(), LAPACKMatrix(), and operator=().
|
private |
Referenced by operator=().