LAPACKMatrix Class Reference

#include <LAPACKMatrix.H>

List of all members.


Detailed Description

Getting sick of writing the basics here over and over. Silly class but it will cut down on the typing.

Public Member Functions

 LAPACKMatrix (int a_nrow, int a_ncol)
 main constructor. Matrix of Chombo Real type. values are unintitialized
 LAPACKMatrix (int a_nrow, int a_ncol, Real *a_data)
 alias constructor. Use a_data as m_data, does not delete it in destructor
 LAPACKMatrix ()
 null constructor builds matrix with nullptr and size=[0,0]
 LAPACKMatrix (const LAPACKMatrix &a_input)
 deep copy constructor
 LAPACKMatrix (LAPACKMatrix &&a_input)
 move copy constructor
Real normLTwo () const
 return sqrt(sum of squares of all values)
void setToIdentity ()
 ~LAPACKMatrix ()
void setVal (const Real &a_val)
RealdataPtr ()
const RealdataPtr () const
void truncate (int a_nrow, int a_ncol)
Real maxNorm () const
const Realoperator() (int irow, int icol) const
Realoperator() (int irow, int icol)
std::pair< int, int > dims () const
LAPACKMatrixoperator= (const LAPACKMatrix &a_matrix)
 deep assign.
LAPACKMatrixoperator= (LAPACKMatrix &&a_matrix)
 move assignment
LAPACKMatrixoperator+= (const LAPACKMatrix &a_matrix)
LAPACKMatrixoperator-= (const LAPACKMatrix &a_matrix)
LAPACKMatrixoperator*= (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
int invertUsingSVD (int a_maxiter, Real a_tol)
 inverts this matrix using SVD
int pseudoInvertUsingSVD (int a_maxiter, Real a_tol)
int pseudoInvertUsingQR ()
int invertUsingLeastSquares ()
 inverts this matrix using least squares
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
static bool s_verbose
static bool s_outputStenData

Private Attributes

int m_nrow
int m_ncol
Realm_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
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)

Constructor & Destructor Documentation

LAPACKMatrix::LAPACKMatrix ( int  a_nrow,
int  a_ncol 
) [inline]

main constructor. Matrix of Chombo Real type. values are unintitialized

LAPACKMatrix::LAPACKMatrix ( int  a_nrow,
int  a_ncol,
Real a_data 
) [inline]

alias constructor. Use a_data as m_data, does not delete it in destructor

LAPACKMatrix::LAPACKMatrix (  )  [inline]

null constructor builds matrix with nullptr and size=[0,0]

LAPACKMatrix::LAPACKMatrix ( const LAPACKMatrix a_input  ) 

deep copy constructor

LAPACKMatrix::LAPACKMatrix ( LAPACKMatrix &&  a_input  )  [inline]

move copy constructor

LAPACKMatrix::~LAPACKMatrix (  ) 


Member Function Documentation

Real LAPACKMatrix::normLTwo (  )  const

return sqrt(sum of squares of all values)

void LAPACKMatrix::setToIdentity (  ) 

if(i==j) M=1 else M=0

void LAPACKMatrix::setVal ( const Real a_val  ) 

Real* LAPACKMatrix::dataPtr (  ) 

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.

Real LAPACKMatrix::maxNorm (  )  const

Get the maximum absolute value of the matrix (for iterative solves)

const Real& LAPACKMatrix::operator() ( int  irow,
int  icol 
) const

Real& LAPACKMatrix::operator() ( int  irow,
int  icol 
)

std::pair<int, int> LAPACKMatrix::dims (  )  const [inline]

References m_ncol, and m_nrow.

LAPACKMatrix& LAPACKMatrix::operator= ( const LAPACKMatrix a_matrix  ) 

deep assign.

LAPACKMatrix& LAPACKMatrix::operator= ( LAPACKMatrix &&  a_matrix  )  [inline]

move assignment

References m_alias, m_data, m_ncol, and m_nrow.

LAPACKMatrix& LAPACKMatrix::operator+= ( const LAPACKMatrix a_matrix  ) 

LAPACKMatrix& LAPACKMatrix::operator-= ( const LAPACKMatrix a_matrix  ) 

LAPACKMatrix& LAPACKMatrix::operator*= ( const Real a_scalingFactor  ) 

int LAPACKMatrix::offset ( int  irow,
int  icol 
) const

void LAPACKMatrix::poutAll (  )  const

void LAPACKMatrix::poutDiag (  )  const

void LAPACKMatrix::poutDiagMatlab (  )  const

void LAPACKMatrix::poutMatlab (  )  const

int LAPACKMatrix::invert (  ) 

inverts this matix

fails if matrix is not square if return value != 0, probably a singular matrix

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

int LAPACKMatrix::pseudoInvertUsingSVD ( int  a_maxiter,
Real  a_tol 
)

int LAPACKMatrix::pseudoInvertUsingQR (  ) 

int LAPACKMatrix::invertUsingLeastSquares (  ) 

inverts this matrix using least squares

Get Ainverse using least squares with svd if return value != 0, lapack was unhappy somehow

void LAPACKMatrix::setSmallCellRow ( const int &  irow  )  [inline]

References m_ncol.

void LAPACKMatrix::transpose (  ) 

void LAPACKMatrix::checkConditionNumber (  )  const

void LAPACKMatrix::checkUpperTriangularConditionNumber (  )  const


Friends And Related Function Documentation

void multiply ( LAPACKMatrix a_product,
const LAPACKMatrix a_left,
const LAPACKMatrix a_right 
) [friend]

sets product = a_left* a_right fails if a_left.m_col != a_right.m_rows

sets product = a_left* a_right fails if a_left.m_col != a_right.m_rows

int solveLeastSquares ( LAPACKMatrix A,
LAPACKMatrix B 
) [friend]

below stuff is shamelessly stolen from lapackwrapper class

Solves A*X = B using general least squares, for each column of B

Solves A*X = B using general least squares, for each column of B

int solveLeastSquaresTranspose ( LAPACKMatrix A,
LAPACKMatrix B 
) [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

int solveLSTSVD ( LAPACKMatrix A,
LAPACKMatrix B,
int  a_maxiter,
Real  a_tol 
) [friend]

Solves A^T X = B using least squares with SVD, for vector b

int solveLSTSVD ( LAPACKMatrix X,
const LAPACKMatrix A,
const LAPACKMatrix B,
int  a_maxiter,
Real  a_tol 
) [friend]

Solves A*X = B using least squares with SVD, for X

int solveLSTSVDOnce ( LAPACKMatrix X,
LAPACKMatrix B 
) [friend]

int solveLSTSVDOnce ( LAPACKMatrix X,
const LAPACKMatrix A,
const LAPACKMatrix B 
) [friend]

Solves A*X = B using least squares with SVD, for X

int solveEqualityConstrainedLS ( LAPACKMatrix A,
LAPACKMatrix c,
LAPACKMatrix B,
LAPACKMatrix d,
LAPACKMatrix x 
) [friend]

Solves equality constrained least squares problem Find x, s.t. min norm(A x - c) with B x = d

int solveReducedRankLS ( LAPACKMatrix A,
LAPACKMatrix b 
) [friend]

Solves A'*X = B using reduced rank least squares, for vector b

Real getInverseOfConditionNumber ( const LAPACKMatrix A  )  [friend]

Following Lapack, gets inverse of condition number. Returning a number near zero means the matrix is not really solvable.

Real getInverseOfUpperTriangularConditionNumber ( const LAPACKMatrix A  )  [friend]


Member Data Documentation

turn on if you want every solve to check the condition number

bool LAPACKMatrix::s_verbose [static]

int LAPACKMatrix::m_nrow [private]

Referenced by dims(), and operator=().

int LAPACKMatrix::m_ncol [private]

Referenced by dims(), operator=(), and setSmallCellRow().

Referenced by operator=().

bool LAPACKMatrix::m_alias = false [private]

Referenced by operator=().


The documentation for this class was generated from the following file:

Generated on Sat Jul 22 04:03:50 2017 for Chombo + EB by  doxygen 1.5.5