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

RazorBack::Basemat_ Class Template Reference

Basemat_: implements the matrix element storage supporting copy-on-write and all matrix operations which can be performed on all matrix elements in parallel, irrespective of the layout. More...

#include <Basemat.hh>

Inheritance diagram for RazorBack::Basemat_:

Inheritance graph
[legend]
Collaboration diagram for RazorBack::Basemat_:

Collaboration graph
[legend]
List of all members.

Public Methods

 Basemat_ ()
 default ctor: proper setup is done in derived classes.

virtual ~Basemat_ ()
 destructor.

virtual size_t rno () const=0
 rno(), cno(): return the number of rows and columns. More...

virtual size_t cno () const=0
virtual vector<T_>::const_iterator operator[] (size_t Idx) const=0
 The C-style [] operator provides unchecked access. More...

virtual vector<T_>::iterator operator[] (size_t Idx)=0
virtual const T_& operator() (size_t Ridx, size_t Cidx) const=0
virtual T_& operator() (size_t Ridx, size_t Cidx)=0
virtual Vector_<T_> row (size_t Idx) const=0
 row(), col(): read or write the Idx:th row or column as a Vector_<T_> object. More...

virtual void row (const Vector_< T_ > &Vec, size_t Idx)=0
virtual Vector_<T_> col (size_t Idx) const=0
virtual void col (const Vector_< T_ > &Vec, size_t Idx)=0
Basemat_<T_>& set_values (const T_ &X=T_(0))
 set_values(): sets all elements to X (0 by default).

bool ftn_idx () const
 ftn_idx(): returns true if FORTRAN indexing is used, false otherwise. More...

bool ftn_idx (bool Fi)
bool range_check () const
 range_check(): returns true if range checking is enabled in operator(). More...

bool range_check (bool Ci)
Basemat_<T_>& operator *= (const T_ &Factor)
 simple arithmetics Multiplication and division by a "scalar" (*=, /=). More...

Basemat_<T_>& operator/= (const T_ &Div)
virtual Vector_<T_> diag () const=0
 diag(): copies the diagonal into a Vector_ object. More...

virtual void diag (const Vector_< T_ > &Vec)=0
virtual void diag_matrix (const T_ &Dval)=0
 diag_matrix(Dval): turns the calling object into a diagonal matrix with the value Dval in all diagonal positions.

virtual T_ trace () const=0
 trace(): returns the sum of the diagonal elements.

void transform (unary_function< T_, T_ > Unaryfunc)
 transform(): this method allows the modification of each element of the calling matrix object "in place" using the STL function object Unaryfunc. More...

virtual void read_matrix (istream &In)=0
 read_matrix(In): reads a matrix from the stream In. More...

virtual void list_matrix (ostream &Out, unsigned int Prec=6, unsigned int Width=13, unsigned int Linewidth=80) const
 Lists the calling object to the stream Out. More...


Protected Methods

const vector<T_>& elems () const
vector<T_>& elems ()
const T_& elems (size_t Idx) const
T_& elems (size_t Idx)
size_t eno () const
size_t eno (size_t E)
virtual void print_rows (ostream &Out, size_t Rw, size_t Jbeg, size_t Items, size_t Width, size_t Prec) const=0

Private Attributes

bool Ftnidx
bool Check

Static Private Methods

size_t prt_width (int N)

Detailed Description

template<class T_> class RazorBack::Basemat_

Basemat_: implements the matrix element storage supporting copy-on-write and all matrix operations which can be performed on all matrix elements in parallel, irrespective of the layout.

Serves as an abstract base class for other matrix classes. Copy-on-write is inherited from the Refstorage_ template.

Definition at line 102 of file Basemat.hh.


Constructor & Destructor Documentation

template<class T_>
RazorBack::Basemat_<T_>::Basemat_<T_> ( ) [inline]
 

default ctor: proper setup is done in derived classes.

Definition at line 113 of file Basemat.hh.

template<class T_>
RazorBack::Basemat_<T_>::~Basemat_<T_> ( ) [inline, virtual]
 

destructor.

Definition at line 116 of file Basemat.hh.


Member Function Documentation

template<class T_>
size_t RazorBack::Basemat_<T_>::rno ( ) const [pure virtual]
 

rno(), cno(): return the number of rows and columns.

Pure virtual at this stage (layout-dependent).

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
virtual size_t RazorBack::Basemat_<T_>::cno ( ) const [pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
vector< T_ >::const_iterator RazorBack::Basemat_<T_>::operator[] ( size_t Idx ) const [pure virtual]
 

The C-style [] operator provides unchecked access.

The two-argument function call operator provides optional checked access when Check is true, and FORTRAN-style indexing when Ftnidx is true. These are pure virtual as they depend on the matrix layout.

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
virtual vector<T_>::iterator RazorBack::Basemat_<T_>::operator[] ( size_t Idx ) [pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
virtual const T_& RazorBack::Basemat_<T_>::operator() ( size_t Ridx,
size_t Cidx ) const [pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
virtual T_& RazorBack::Basemat_<T_>::operator() ( size_t Ridx,
size_t Cidx ) [pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
Vector_< T_ > RazorBack::Basemat_<T_>::row ( size_t Idx ) const [pure virtual]
 

row(), col(): read or write the Idx:th row or column as a Vector_<T_> object.

Pure virtual: depends on layout.

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
virtual void RazorBack::Basemat_<T_>::row ( const Vector_< T_ > & Vec,
size_t Idx ) [pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
virtual Vector_<T_> RazorBack::Basemat_<T_>::col ( size_t Idx ) const [pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
virtual void RazorBack::Basemat_<T_>::col ( const Vector_< T_ > & Vec,
size_t Idx ) [pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
Basemat_< T_ > & RazorBack::Basemat_<T_>::set_values ( const T_ & X = T_(0) ) [inline]
 

set_values(): sets all elements to X (0 by default).

Definition at line 149 of file Basemat.hh.

template<class T_>
bool RazorBack::Basemat_<T_>::ftn_idx ( ) const [inline]
 

ftn_idx(): returns true if FORTRAN indexing is used, false otherwise.

ftn_idx(Fi): sets the FORTRAN indexing to Fi, returns old value. The Ftnidx status is ignored when [] indexing is used.

Definition at line 161 of file Basemat.hh.

template<class T_>
bool RazorBack::Basemat_<T_>::ftn_idx ( bool Fi ) [inline]
 

Definition at line 162 of file Basemat.hh.

template<class T_>
bool RazorBack::Basemat_<T_>::range_check ( ) const [inline]
 

range_check(): returns true if range checking is enabled in operator().

range_check(Ci): sets the range_check status, returns old value. Range checking is ignored when [] indexing is used.

Definition at line 169 of file Basemat.hh.

template<class T_>
bool RazorBack::Basemat_<T_>::range_check ( bool Ci ) [inline]
 

Definition at line 170 of file Basemat.hh.

template<class T_>
Basemat_< T_ > & RazorBack::Basemat_<T_>::operator *= ( const T_ & Factor )
 

simple arithmetics Multiplication and division by a "scalar" (*=, /=).

Consider Mat*=(1.0/X) instead of Mat/=X if X is floating-point.

template<class T_>
Basemat_<T_>& RazorBack::Basemat_<T_>::operator/= ( const T_ & Div )
 

template<class T_>
Vector_< T_ > RazorBack::Basemat_<T_>::diag ( ) const [pure virtual]
 

diag(): copies the diagonal into a Vector_ object.

diag(Vec): sets the diagonal to the values in the Vector_ object Vec.

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
virtual void RazorBack::Basemat_<T_>::diag ( const Vector_< T_ > & Vec ) [pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
void RazorBack::Basemat_<T_>::diag_matrix ( const T_ & Dval ) [pure virtual]
 

diag_matrix(Dval): turns the calling object into a diagonal matrix with the value Dval in all diagonal positions.

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
T_ RazorBack::Basemat_<T_>::trace ( ) const [pure virtual]
 

trace(): returns the sum of the diagonal elements.

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
void RazorBack::Basemat_<T_>::transform ( unary_function< T_, T_ > Unaryfunc ) [inline]
 

transform(): this method allows the modification of each element of the calling matrix object "in place" using the STL function object Unaryfunc.

Could be used for things like taking the square root of each matrix element.

Definition at line 204 of file Basemat.hh.

template<class T_>
void RazorBack::Basemat_<T_>::read_matrix ( istream & In ) [pure virtual]
 

read_matrix(In): reads a matrix from the stream In.

The appropriate version will be invoked by the overloaded >> method in each derived class.

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
void RazorBack::Basemat_<T_>::list_matrix ( ostream & Out,
unsigned int Prec = 6,
unsigned int Width = 13,
unsigned int Linewidth = 80 ) const [virtual]
 

Lists the calling object to the stream Out.

The parameters provide formatting facilities, normally you would just use the overloaded << method that invokes list_matrix() with the default parameters.

template<class T_>
const vector< T_ > & RazorBack::Basemat_<T_>::elems<T_> ( ) const [inline, protected]
 

Definition at line 235 of file Basemat.hh.

Referenced by RazorBack::Rectmat_::Rectmat_(), RazorBack::Symmat_::at(), RazorBack::Symmat_::operator[](), RazorBack::Rectmat_::operator[](), set_values(), and transform().

template<class T_>
vector< T_ > & RazorBack::Basemat_<T_>::elems<T_> ( ) [inline, protected]
 

Definition at line 236 of file Basemat.hh.

template<class T_>
const T_ & RazorBack::Basemat_<T_>::elems ( size_t Idx ) const [inline, protected]
 

Definition at line 237 of file Basemat.hh.

template<class T_>
T_ & RazorBack::Basemat_<T_>::elems ( size_t Idx ) [inline, protected]
 

Definition at line 238 of file Basemat.hh.

template<class T_>
size_t RazorBack::Basemat_<T_>::eno ( ) const [inline, protected]
 

Definition at line 239 of file Basemat.hh.

template<class T_>
size_t RazorBack::Basemat_<T_>::eno ( size_t E ) [inline, protected]
 

Definition at line 240 of file Basemat.hh.

template<class T_>
virtual void RazorBack::Basemat_<T_>::print_rows ( ostream & Out,
size_t Rw,
size_t Jbeg,
size_t Items,
size_t Width,
size_t Prec ) const [protected, pure virtual]
 

Reimplemented in RazorBack::Rectmat_, and RazorBack::Symmat_.

template<class T_>
size_t RazorBack::Basemat_<T_>::prt_width ( int N ) [inline, static, private]
 

Definition at line 246 of file Basemat.hh.


Member Data Documentation

template<class T_>
bool RazorBack::Basemat_<T_>::Ftnidx [private]
 

Definition at line 106 of file Basemat.hh.

template<class T_>
bool RazorBack::Basemat_<T_>::Check [private]
 

Definition at line 107 of file Basemat.hh.


The documentation for this class was generated from the following file:
Generated at Wed Aug 21 09:33:25 2002 for The Razorback C++ Library: Linear Algebra by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001