Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

GeneralRealMatrix Class Reference

#include <GeneralRealMatrix.hh>

List of all members.

Public Member Functions

 GeneralRealMatrix (int NumRows2, int NumCol2)
 GeneralRealMatrix (const GeneralRealMatrix &Copy)
 ~GeneralRealMatrix (void)
void WriteFileMatrix (string OutFileName)
double Get (int i, int j) const
void Set (int i, int j, double Val)
double & Element (int i, int j)
 Accesses memory location of (i,j)-element of matrix.
int GetNumRows (void) const
int GetNumCols (void) const
void SetAll (double Val)
 Sets all elements of the matrix to Val.
void Zero (void)
 Sets this matrix to be zero.
void Multiply (const GeneralRealMatrix &A, const GeneralRealMatrix &B)
 Matrix multiplication. Sets this matrix to be the product C = A*B.
void MultiplyTrans (const GeneralRealMatrix &A, const GeneralRealMatrix &B)
 Sets this matrix to be the product C = Transpose(A)*B.
void Image (const GeneralRealMatrix &X, GeneralRealMatrix &Y) const
 Produce image, Y = A * X, where A is this.
void Symmetrize (void)
 For square matricies, sets this = 0.5*(this + Transpose(this)).
void Transpose (GeneralRealMatrix &Atrans) const
 Sets Atrans to be the transpose of this matrix.
int Solve (GeneralRealMatrix &X, const GeneralRealMatrix &B) const
void SymmetricEig (GeneralRealMatrix &EigValue, GeneralRealMatrix &EigVector) const

Public Attributes

double * Data

Private Member Functions

void BoundsCheck (int i, int j) const

Private Attributes

int NumRows
int NumCols

Constructor & Destructor Documentation

GeneralRealMatrix::GeneralRealMatrix ( int  NumRows2,
int  NumCol2 
)

References Data, NumCols, and NumRows.

GeneralRealMatrix::GeneralRealMatrix ( const GeneralRealMatrix Copy  ) 

References Data, NumCols, and NumRows.

GeneralRealMatrix::~GeneralRealMatrix ( void   ) 

References Data.


Member Function Documentation

void GeneralRealMatrix::BoundsCheck ( int  i,
int  j 
) const [inline, private]
double& GeneralRealMatrix::Element ( int  i,
int  j 
) [inline]

Accesses memory location of (i,j)-element of matrix.

Typical use: Element(i,j) += Val

Referenced by Image(), Multiply(), MultiplyTrans(), Symmetrize(), and Transpose().

double GeneralRealMatrix::Get ( int  i,
int  j 
) const [inline]

Gets the (i,j) element of the matrix, where 1 <= i <= NumRows, 1<=j <= NumCols

The matrix is stored in the array Data in Column Major order A(i,j) = Data[ (i-1) + (j-1) * NumRows ], i.e. elements on the same column of A are stored contiguously in Data. This is the convention used in Fortran, and hence in BLAS and Lapack

Referenced by Image(), Multiply(), MultiplyTrans(), Symmetrize(), Transpose(), and WriteFileMatrix().

int GeneralRealMatrix::GetNumCols ( void   )  const [inline]
int GeneralRealMatrix::GetNumRows ( void   )  const [inline]
void GeneralRealMatrix::Image ( const GeneralRealMatrix X,
GeneralRealMatrix Y 
) const

Produce image, Y = A * X, where A is this.

References Element(), Get(), NumCols, NumRows, and Zero().

void GeneralRealMatrix::Multiply ( const GeneralRealMatrix A,
const GeneralRealMatrix B 
)

Matrix multiplication. Sets this matrix to be the product C = A*B.

References Element(), Get(), NumCols, NumRows, and Zero().

void GeneralRealMatrix::MultiplyTrans ( const GeneralRealMatrix A,
const GeneralRealMatrix B 
)

Sets this matrix to be the product C = Transpose(A)*B.

References Element(), Get(), NumCols, NumRows, and Zero().

void GeneralRealMatrix::Set ( int  i,
int  j,
double  Val 
) [inline]

Gets the (i,j) element of the matrix to Val, where 1 <= i <= NumRows, 1<=j <= NumCols

void GeneralRealMatrix::SetAll ( double  Val  ) 

Sets all elements of the matrix to Val.

References Data, NumCols, and NumRows.

Referenced by Zero().

int GeneralRealMatrix::Solve ( GeneralRealMatrix X,
const GeneralRealMatrix B 
) const

Solves A*X=B for X, where A = this matrix is assumed to be square WARNING: This method has not been tested!!!

References Data, dgetrf(), dgetrs(), F77NAME, NumCols, and NumRows.

void GeneralRealMatrix::SymmetricEig ( GeneralRealMatrix EigValue,
GeneralRealMatrix EigVector 
) const

Finds the eigenvalues and eigenvectors of this matrix, which is symmetric.

References Data, dsyev(), F77NAME, ilaenv(), max(), NumCols, and NumRows.

void GeneralRealMatrix::Symmetrize ( void   ) 

For square matricies, sets this = 0.5*(this + Transpose(this)).

References Element(), Get(), NumCols, and NumRows.

void GeneralRealMatrix::Transpose ( GeneralRealMatrix Atrans  )  const

Sets Atrans to be the transpose of this matrix.

References Element(), Get(), NumCols, and NumRows.

void GeneralRealMatrix::WriteFileMatrix ( string  OutFileName  ) 

References Get(), NumCols, and NumRows.

void GeneralRealMatrix::Zero ( void   ) 

Sets this matrix to be zero.

References SetAll().

Referenced by Image(), Multiply(), and MultiplyTrans().


Member Data Documentation


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