psi::Matrix Class Reference
[libmints: Integral library]

Makes using matrices just a little earlier. More...

#include <matrix.h>

List of all members.

Public Member Functions

 Matrix ()
 Default constructor, zeros everything out.
 Matrix (std::string name)
 Constructor, zeros everything out, sets name_.
 Matrix (const Matrix &copy)
 Explicit copy reference constructor.
 Matrix (shared_ptr< Matrix > copy)
 Matrix (Matrix &copy)
 Matrix (const Matrix *copy)
 Explicit copy pointer constructor.
 Matrix (int nirreps, int *rowspi, int *colspi)
 Constructor, sets up the matrix.
 Matrix (std::string name, int nirreps, int *rowspi, int *colspi)
 Constructor, sets name_, and sets up the matrix.
 ~Matrix ()
 Destructor, frees memory.
void init (int nirreps, int *rowspi, int *colspi, std::string name="")
 Initializes a matrix.
Matrixclone () const
 Creates an exact copy of the matrix and returns it.
void copy (Matrix *cp)
 Copies cp's data onto this.
void copy (Matrix &cp)
void copy (shared_ptr< Matrix > cp)
void copy (const Matrix &cp)
void copy (const Matrix *cp)
bool load (psi::PSIO *psio, unsigned int fileno, char *tocentry, int nso)
 Load a matrix from a PSIO object from fileno with tocentry of size nso.
bool load (shared_ptr< psi::PSIO > psio, unsigned int fileno, char *tocentry, int nso)
void save (const char *filename, bool append=true, bool saveLowerTriangle=true, bool saveSubBlocks=false)
 Saves the matrix in ASCII format to filename.
void save (std::string filename, bool append=true, bool saveLowerTriangle=true, bool saveSubBlocks=false)
void save (psi::PSIO *psio, unsigned int fileno, bool saveSubBlocks=true)
 Saves the block matrix to PSIO object with fileno and with the toc position of the name of the matrix.
void save (shared_ptr< psi::PSIO > psio, unsigned int fileno, bool saveSubBlocks=true)
void set (double val)
 Set every element of matrix_ to val.
void set (const double *tri)
 Copies lower triangle tri to matrix_, calls tri_to_sq.
void set (const double **sq)
 Copies sq to matrix_.
void set (SimpleMatrix *sq)
 Copies sq to matrix_.
void set (shared_ptr< SimpleMatrix > sq)
void set (int h, int m, int n, double val)
 Set a single element of matrix_.
void set (Vector *vec)
 Set the diagonal of matrix_ to vec.
void set (Vector &vec)
void set (shared_ptr< Vector > vec)
double get (int h, int m, int n)
 Returns a single element of matrix_.
double ** to_block_matrix () const
 Returns matrix_.
double * to_lower_triangle () const
SimpleMatrixto_simple_matrix ()
 Converts this to a full non-symmetry-block matrix.
void set_name (std::string name)
 Sets the name of the matrix, used in print(...) and save(...).
void print (FILE *out=outfile, char *extra=NULL)
 Print the matrix using print_mat.
void eivprint (Vector *values, FILE *out=outfile)
 Print the matrix with corresponding eigenvalues below each column.
void eivprint (Vector &values, FILE *out=outfile)
 Print the matrix with corresponding eigenvalues below each column.
void eivprint (shared_ptr< Vector > values, FILE *out=outfile)
 Print the matrix with corresponding eigenvalues below each column.
int * rowspi () const
 Returns the rows per irrep array.
int * colspi () const
 Returns the columns per irrep array.
int nirreps () const
 Returns the number of irreps.
void set_to_identity ()
 Set this to identity.
void zero ()
 Zeros this out.
void zero_diagonal ()
 Zeros the diagonal.
double trace ()
 Returns the trace of this.
Matrixtranspose ()
 Creates a new matrix which is the transpose of this.
void add (const Matrix *)
 Adds a matrix to this.
void add (const Matrix &)
 Adds a matrix to this.
void add (shared_ptr< Matrix >)
 Adds a matrix to this.
void subtract (const Matrix *)
 Subtracts a matrix from this.
void subtract (shared_ptr< Matrix >)
 Subtracts a matrix from this.
void accumulate_product (const Matrix *, const Matrix *)
 Multiplies the two arguments and adds their result to this.
void accumulate_product (shared_ptr< Matrix >, shared_ptr< Matrix >)
void scale (double)
 Scales this matrix.
double sum_of_squares ()
 Returns the sum of the squares of this.
void add (int h, int m, int n, double val)
 Add val to an element of this.
void scale_row (int h, int m, double a)
 Scale row m of irrep h by a.
void scale_column (int h, int n, double a)
 Scale column n of irrep h by a.
void transform (Matrix *a, Matrix *transformer)
 Transform a by transformer save result to this.
void transform (shared_ptr< Matrix > a, shared_ptr< Matrix > transformer)
void transform (Matrix *transformer)
 Transform this by transformer.
void transform (shared_ptr< Matrix > transformer)
void back_transform (Matrix *a, Matrix *transformer)
 Back transform a by transformer save result to this.
void back_transform (shared_ptr< Matrix > a, shared_ptr< Matrix > transformer)
void back_transform (Matrix *transformer)
 Back transform this by transformer.
void back_transform (shared_ptr< Matrix > transformer)
double vector_dot (Matrix *rhs)
 Returns the vector dot product of this by rhs.
double vector_dot (shared_ptr< Matrix > rhs)
void gemm (bool transa, bool transb, double alpha, const Matrix *a, const Matrix *b, double beta)
 General matrix multiply, saves result to this.
void gemm (bool transa, bool transb, double alpha, shared_ptr< Matrix > a, shared_ptr< Matrix > b, double beta)
void gemm (bool transa, bool transb, double alpha, shared_ptr< Matrix > a, Matrix &b, double beta)
void gemm (bool transa, bool transb, double alpha, Matrix &a, shared_ptr< Matrix > b, double beta)
void diagonalize (Matrix *eigvectors, Vector *eigvalues)
 Diagonalize this places eigvectors and eigvalues must be created by caller.
void diagonalize (shared_ptr< Matrix > eigvectors, shared_ptr< Vector > eigvalues)
void transform (Matrix &a, Matrix &transformer)
 Transform a by transformer save result to this.
void transform (Matrix &transformer)
 Transform this by transformer.
void back_transform (Matrix &a, Matrix &transformer)
 Back transform a by transformer save result to this.
void back_transform (Matrix &transformer)
 Back transform this by transformer.
double vector_dot (Matrix &rhs)
 Returns the vector dot product of this by rhs.
void gemm (bool transa, bool transb, double alpha, const Matrix &a, const Matrix &b, double beta)
 General matrix multiply, saves result to this.
void diagonalize (Matrix &eigvectors, Vector &eigvalues)
 Diagonalize this places eigvectors and eigvalues must be created by caller.

Protected Member Functions

void alloc ()
 Allocates matrix_.
void release ()
 Release matrix_.
void copy_from (double ***)
 Copies data from the passed matrix to this matrix_.
void print_mat (double **a, int m, int n, FILE *out)

Static Protected Member Functions

static double ** matrix (int nrow, int ncol)
 allocate a block matrix -- analogous to libciomr's block_matrix
static void free (double **Block)
 free a (block) matrix -- analogous to libciomr's free_block

Protected Attributes

double *** matrix_
 Matrix data.
int nirreps_
 Number of irreps.
int * rowspi_
 Rows per irrep array.
int * colspi_
 Columns per irrep array.
std::string name_
 Name of the matrix.


Detailed Description

Makes using matrices just a little earlier.

Using a matrix factory makes creating these a breeze.


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

Generated on Mon Dec 21 14:14:47 2009 for PSI by  doxygen 1.5.6