Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

MatrixC Template Class Reference

#include <matrix.h>

Inheritance diagram for MatrixC:

Matrix MatrixBD MatrixFD MatrixFI MatrixSD VectorD VectorI List of all members.

Public Methods

virtual int capacity () const
 current capacity will be removed r.s.n.

bool operator== (const MatrixC<Tp>& B) const
 logical operator equal, uses STL equal.

bool operator!= (const MatrixC<Tp>& B) const
 logical operator not equal, uses STL equal.

constructors and destructor
 MatrixC ()
 default constructor.

 MatrixC (const int nr, const int nc, const Tp value=0)
 standard constructor.

 MatrixC (const int nr, const int nc, const int nu, const Tp value)
 constructor to be called for banded matrices.

 MatrixC (const Tp* A, const int nr, const int nc=1)
 constructor that takes a double array of length nr*nc.

 MatrixC (const valarray<Tp>& A, const int nc=1)
 constructor from a valarray, the optional argument nc is the number of columns.

 MatrixC (const MatrixC& B)
 copy constructor.

virtual ~MatrixC ()
 virtual destructor.

assignment
MatrixC& operator= (const MatrixC& B)
 assignment operator.

virtual MatrixC& operator= (const Tp value)
 assignment with a constant value.

overloaded virtual methods of the base class Matrix
these methods provide default implementations for derived classes

virtual int nr (const int i=0) const
 number of rows.

virtual int nc (const int i=0) const
 number of columns.

virtual int size () const
 size is the number of elements of the Matrix.

virtual bool empty () const
 true if the Matrix is empty.

virtual Ref<Tp> operator() (const int i, const int j=0)
 non constant, write access to elements.

virtual Tp operator() (const int i, const int j=0) const
 constant, read only access to elements.

miscellaneous methods
void get_own_copy ()
 get own copy of matrix data.

void resize (const int nr, const int nc, const Tp value=0)
 resize Matrix.

virtual void stream (istream& s)
 input from stream.

virtual void stream (ostream& s)
 output to stream.

virtual MatrixC& assign (const int nc, const Tp* value)
 assign Matrix with a C-style array, uses fast unchecked write access.

virtual MatrixC& assign (const int nr, const int nc, const Tp* value)
 assign Matrix with a C-style array, uses fast unchecked write access.

virtual MatrixC& assign (const int nr, const int nc, const Tp** value)
 assign Matrix with the old LinAl C-style Matrix.

conversion operator for use of MatrixC as a C-style array
User defined conversion operators are at least controversial since they allow direct, unchecked but also fast access to the raw matrix data in C and Fortran functions.

They are necessary for the BLAS and LAPACK interface but they could possibly at least be made protected.

 operator Tp * () const
 read access.

 operator Tp * ()
 read and write access.

Matrix low level algebraic methods
The following methods implement low level algebraic functionality.

These methods are called internally by the algebraic operators. The standard methods are guaranteed to work for all derived classes, because they are generic algorithms using operator() to access elements. When the implementation is optimized for speed, these methods should be overloaded.

MatrixC<Tp> transpose () const
 return transposed Matrix.

void add (const MatrixC<Tp>& B)
 add Matrix B to this Matrix.

void add (const Tp value)
 add constant value this Matrix.

void subtract (const MatrixC<Tp>& B)
 subtract Matrix B from this Matrix.

void subtract (const Tp value)
 subtract constant value from this Matrix.

void multiply (const MatrixC<Tp>& A, const MatrixC<Tp>& B, const char TRANSA=0, const char TRANSB=0, const Tp ALPHA=1, const Tp BETA=0)
 multiply Matrix A with Matrix B and write to this Matrix.

void multiply (const Tp value)
 multiply this Matrix with constant value.


Protected Methods

protected access to MatrixC data for members and derived classes
virtual Tp& operator[] (const int i) const
 fast sequential access operator[], available to members only.

virtual Tp& operator[] (const int i)
 fast sequential access operator[], available to members only.

virtual Tp* ref (const int i, const int j) const
 low level reference to data returns a pointer, use this with care.

virtual Tp read (const int i, const int j) const
 low level read.

virtual void write (const int i, const int j, const Tp v)
 low level write.

virtual void add (const int i, const int j, const Tp v)
 low level add to.

virtual void sub (const int i, const int j, const Tp v)
 low level sub from.

virtual void mul (const int i, const int j, const Tp v)
 low level mul with.

virtual void div (const int i, const int j, const Tp v)
 low level div by.


Protected Attributes

MdataC<Tp>* D
 MatrixC<Tp> contains only a pointer to the actual data representation.


Constructor & Destructor Documentation

template<classTp>
MatrixC<Tp>::MatrixC<Tp> ( ) [inline, explicit]
 

default constructor.

template<classTp>
MatrixC<Tp>::MatrixC<Tp> ( const int nr,
const int nc,
const Tp value = 0 ) [inline, explicit]
 

standard constructor.

template<classTp>
MatrixC<Tp>::MatrixC<Tp> ( const int nr,
const int nc,
const int nu,
const Tp value ) [inline, explicit]
 

constructor to be called for banded matrices.

template<classTp>
MatrixC<Tp>::MatrixC<Tp> ( const Tp * A,
const int nr,
const int nc = 1 ) [inline, explicit]
 

constructor that takes a double array of length nr*nc.

template<classTp>
MatrixC<Tp>::MatrixC<Tp> ( const valarray< Tp >& A,
const int nc = 1 ) [inline, explicit]
 

constructor from a valarray, the optional argument nc is the number of columns.

template<classTp>
MatrixC<Tp>::MatrixC<Tp> ( const MatrixC<Tp> & B ) [inline]
 

copy constructor.

template<classTp>
MatrixC<Tp>::~MatrixC<Tp> ( ) [inline, virtual]
 

virtual destructor.


Member Function Documentation

template<classTp>
MatrixC<Tp> & MatrixC<Tp>::operator= ( const MatrixC<Tp> & B )
 

assignment operator.

template<classTp>
MatrixC<Tp> & MatrixC<Tp>::operator= ( const Tp value ) [virtual]
 

assignment with a constant value.

template<classTp>
int MatrixC<Tp>::nr ( const int i = 0 ) const [inline, virtual]
 

number of rows.

Reimplemented from Matrix.

Reimplemented in MatrixBD, and MatrixSD.

template<classTp>
int MatrixC<Tp>::nc ( const int i = 0 ) const [inline, virtual]
 

number of columns.

Reimplemented from Matrix.

Reimplemented in MatrixBD, and MatrixSD.

template<classTp>
int MatrixC<Tp>::size ( ) const [inline, virtual]
 

size is the number of elements of the Matrix.

Reimplemented from Matrix.

template<classTp>
bool MatrixC<Tp>::empty ( ) const [inline, virtual]
 

true if the Matrix is empty.

Reimplemented from Matrix.

template<classTp>
Ref< Tp > MatrixC<Tp>::operator() ( const int i,
const int j = 0 ) [inline, virtual]
 

non constant, write access to elements.

Reimplemented from Matrix.

Reimplemented in MatrixBD, MatrixSD, VectorD, and VectorI.

template<classTp>
Tp MatrixC<Tp>::operator() ( const int i,
const int j = 0 ) const [inline, virtual]
 

constant, read only access to elements.

Reimplemented from Matrix.

Reimplemented in MatrixBD, MatrixSD, VectorD, and VectorI.

template<classTp>
void MatrixC<Tp>::get_own_copy ( ) [inline]
 

get own copy of matrix data.

template<classTp>
void MatrixC<Tp>::resize ( const int nr,
const int nc,
const Tp value = 0 )
 

resize Matrix.

template<classTp>
void MatrixC<Tp>::stream ( istream & s ) [virtual]
 

input from stream.

template<classTp>
void MatrixC<Tp>::stream ( ostream & s ) [virtual]
 

output to stream.

Reimplemented in MatrixBD, MatrixSD, VectorD, and VectorI.

template<classTp>
MatrixC<Tp> & MatrixC<Tp>::assign ( const int nc,
const Tp * value ) [virtual]
 

assign Matrix with a C-style array, uses fast unchecked write access.

template<classTp>
MatrixC<Tp> & MatrixC<Tp>::assign ( const int nr,
const int nc,
const Tp * value ) [virtual]
 

assign Matrix with a C-style array, uses fast unchecked write access.

template<classTp>
MatrixC<Tp> & MatrixC<Tp>::assign ( const int nr,
const int nc,
const Tp ** value ) [virtual]
 

assign Matrix with the old LinAl C-style Matrix.

template<classTp>
int MatrixC<Tp>::capacity ( ) const [inline, virtual]
 

current capacity will be removed r.s.n.

template<classTp>
bool MatrixC<Tp>::operator== ( const MatrixC< Tp >& B ) const
 

logical operator equal, uses STL equal.

template<classTp>
bool MatrixC<Tp>::operator!= ( const MatrixC< Tp >& B ) const
 

logical operator not equal, uses STL equal.

template<classTp>
MatrixC<Tp>::operator Tp * ( ) const [inline]
 

read access.

template<classTp>
MatrixC<Tp>::operator Tp * ( ) [inline]
 

read and write access.

template<classTp>
MatrixC< Tp > MatrixC<Tp>::transpose ( ) const
 

return transposed Matrix.

Reimplemented in MatrixBD, MatrixFD, MatrixSD, and VectorD.

template<classTp>
void MatrixC<Tp>::add ( const MatrixC< Tp >& B )
 

add Matrix B to this Matrix.

template<classTp>
void MatrixC<Tp>::add ( const Tp value )
 

add constant value this Matrix.

template<classTp>
void MatrixC<Tp>::subtract ( const MatrixC< Tp >& B )
 

subtract Matrix B from this Matrix.

template<classTp>
void MatrixC<Tp>::subtract ( const Tp value )
 

subtract constant value from this Matrix.

template<classTp>
void MatrixC<Tp>::multiply ( const MatrixC< Tp >& A,
const MatrixC< Tp >& B,
const char TRANSA = 0,
const char TRANSB = 0,
const Tp ALPHA = 1,
const Tp BETA = 0 )
 

multiply Matrix A with Matrix B and write to this Matrix.

template<classTp>
void MatrixC<Tp>::multiply ( const Tp value )
 

multiply this Matrix with constant value.

template<classTp>
Tp & MatrixC<Tp>::operator[] ( const int i ) const [inline, protected, virtual]
 

fast sequential access operator[], available to members only.

template<classTp>
Tp & MatrixC<Tp>::operator[] ( const int i ) [inline, protected, virtual]
 

fast sequential access operator[], available to members only.

template<classTp>
Tp * MatrixC<Tp>::ref ( const int i,
const int j ) const [inline, protected, virtual]
 

low level reference to data returns a pointer, use this with care.

Reimplemented from Matrix.

Reimplemented in MatrixBD, and MatrixSD.

template<classTp>
Tp MatrixC<Tp>::read ( const int i,
const int j ) const [inline, protected, virtual]
 

low level read.

Reimplemented from Matrix.

Reimplemented in MatrixBD, and MatrixSD.

template<classTp>
void MatrixC<Tp>::write ( const int i,
const int j,
const Tp v ) [inline, protected, virtual]
 

low level write.

Reimplemented from Matrix.

template<classTp>
void MatrixC<Tp>::add ( const int i,
const int j,
const Tp v ) [inline, protected, virtual]
 

low level add to.

Reimplemented from Matrix.

template<classTp>
void MatrixC<Tp>::sub ( const int i,
const int j,
const Tp v ) [inline, protected, virtual]
 

low level sub from.

Reimplemented from Matrix.

template<classTp>
void MatrixC<Tp>::mul ( const int i,
const int j,
const Tp v ) [inline, protected, virtual]
 

low level mul with.

Reimplemented from Matrix.

template<classTp>
void MatrixC<Tp>::div ( const int i,
const int j,
const Tp v ) [inline, protected, virtual]
 

low level div by.

Reimplemented from Matrix.


Member Data Documentation

template<classTp>
MdataC< Tp >* MatrixC<Tp>::D [protected]
 

MatrixC<Tp> contains only a pointer to the actual data representation.


The documentation for this class was generated from the following file:
Generated at Wed Nov 22 08:38:29 2000 for LinAl - a simple and efficient Matrix library - by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000