Main Page | Compound List | File List | Compound Members | File Members | Examples

Matrix< Z > Class Template Reference

#include <matrix.h>

List of all members.

Public Member Functions

 Matrix (unsigned int Rows, unsigned int Cols)
 Empty Constructor.

 Matrix (Z *elements,unsigned int Rows, unsigned int Cols)
 Initilizing constructor.

 Matrix (const Matrix &A)
 Assignment Constructor.

Matrixoperator= (const Matrix &C)
 Copy Constructor.

Z & operator() (unsigned int i, unsigned int j)
 Elementwise Access.

Matrixoperator+= (const Matrix &M)
 In place addition.

Matrixoperator-= (const Matrix &M)
 In place subtraction (see above).

Matrixoperator *= (Matrix M)
 In place multiplication.

template<typename S> Matrixoperator *= (const S &s)
 In place scalar multiplication.

void dump (const char *filename)
 Dump matrix to filename.

void read (const char *filename)
 Read matrix from file created by dump(const char*).


Public Attributes

Z * A
 Pointer to the matrix elements.

unsigned int M
 Number of Rows.

unsigned int N
 Number of Columns.


Friends

std::ostream & operator<< (std::ostream &, const Matrix &)
 Output operator.


Detailed Description

template<typename Z>
class Matrix< Z >

Matrix Class Takes any built in type or standard library types such as std::complex<double> as its template argument.
Examples:

example_entanglement.cpp, example_matrix.cpp, and example_mlapack.cpp.


Constructor & Destructor Documentation

template<typename Z>
Matrix< Z >::Matrix unsigned int  Rows,
unsigned int  Cols
 

Takes two arguments specifying the rows and columns

template<typename Z>
Matrix< Z >::Matrix Z *  elements,
unsigned int  Rows,
unsigned int  Cols
 

This takes an additional pointer to an initilizing array containing the matrix elements. For example

 int a[] = {1,2,3,4}; 
 Matrix<int> A(a,2,2); 


Member Function Documentation

template<typename Z>
Matrix< Z > & Matrix< Z >::operator+= const Matrix< Z > &  M  ) 
 

This performs A = A+B. It is usually preferably to do addition like this when you're worried about performance as it doesn't require any temporary variables or copying of return values


The documentation for this class was generated from the following file:
Generated on Mon Sep 8 14:37:53 2003 for QIMatrix by doxygen 1.3.2