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

RazorBack::Symmat_ Class Template Reference

Class Symmat_: a class of symmetric square matrices (Row x Row). More...

#include <Symmat.hh>

Inheritance diagram for RazorBack::Symmat_:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 Symmat_ (size_t S=3)
 default ctor: 3x3 is the default size.

 Symmat_ (const Symmat_< T_ > &Sm)
 copy ctor.

 Symmat_ (const T_ *Arr, size_t S)
 init Symmat_ with a conventional array. More...

virtual ~Symmat_ ()
 destructor.

 operator Rectmat_ () const
 Symmat->Rectmat conversion.

Symmat_<T_>& triangle (const Rectmat_< T_ > &Rect, bool Low=true)
 triangle(Rect, Low): copies the lower triangle of Rect to the calling object if Low is true (default) or the upper triangle if Low is false. More...

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

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

virtual vector<T_>::iterator operator[] (size_t Idx)
const T_& at (size_t Ridx, size_t Cidx) const
 at(Ridx, Cidx): does unchecked C indexing but Ridx and Cidx are swapped if Ridx<Cidx.

T_& at (size_t Ridx, size_t Cidx)
virtual const T_& operator() (size_t Ridx, size_t Cidx) const
 The two-argument function call operator provides optional checked access when Check is true, and FORTRAN-style indexing when Ftnidx is true. More...

virtual T_& operator() (size_t Ridx, size_t Cidx)
void size (size_t S)
 size(S): changes the size of the calling object to S x S. More...

virtual Vector_<T_> row (size_t Idx) const
 row(Idx): returns the Idx-th row as a Vector_ object safely. More...

virtual void row (const Vector_< T_ > &Vec, size_t Idx)
virtual Vector_<T_> col (size_t Idx) const
virtual void col (const Vector_< T_ > &Vec, size_t Idx)
Symmat_<T_> operator * (const T_ &Factor) const
 Simple scalar operations.

Symmat_<T_> operator/ (const T_ &Div) const
Symmat_<T_>& operator+= (const Symmat_< T_ > &Mat)
 Matrix addition and subtraction. More...

Symmat_<T_> operator+ (const Symmat_< T_ > &Mat) const
Rectmat_<T_> operator+ (const Rectmat_< T_ > &Mat) const
Symmat_<T_>& operator-= (const Symmat_< T_ > &Mat)
Symmat_<T_> operator- (const Symmat_< T_ > &Mat) const
Rectmat_<T_> operator * (const Symmat_< T_ > &Mat) const
 Matrix*matrix and matrix*vector multiplication. More...

Rectmat_<T_> operator * (const Rectmat_< T_ > &Mat) const
Vector_<T_> operator * (const Vector_< T_ > &Vec) const
virtual Vector_<T_> diag () const
 diag(): copies the diagonal into a Vector_ object. More...

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

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

virtual void read_matrix (istream &In)
 I/O.


Protected Methods

void print_rows (ostream &Out, size_t Rw, size_t Jbeg, size_t Items, size_t Width, size_t Prec) const
 hidden methods.


Static Protected Methods

unsigned int tri_size (unsigned int X)

Private Attributes

size_t Size

Detailed Description

template<class T_> class RazorBack::Symmat_

Class Symmat_: a class of symmetric square matrices (Row x Row).

Derived from Basemat_.

Definition at line 39 of file Symmat.hh.


Constructor & Destructor Documentation

template<class T_>
RazorBack::Symmat_<T_>::Symmat_<T_> ( size_t S = 3 ) [inline, explicit]
 

default ctor: 3x3 is the default size.

Definition at line 59 of file Symmat.hh.

template<class T_>
RazorBack::Symmat_<T_>::Symmat_<T_> ( const Symmat_< T_ > & Sm ) [inline]
 

copy ctor.

Definition at line 68 of file Symmat.hh.

template<class T_>
RazorBack::Symmat_<T_>::Symmat_<T_> ( const T_ * Arr,
size_t S ) [inline]
 

init Symmat_ with a conventional array.

It is supposed to have the "triangular" row-major layout. No checks

Definition at line 75 of file Symmat.hh.

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

destructor.

Definition at line 85 of file Symmat.hh.


Member Function Documentation

template<class T_>
RazorBack::Symmat_<T_>::operator Rectmat_< T_ > ( ) const
 

Symmat->Rectmat conversion.

template<class T_>
Symmat_< T_ > & RazorBack::Symmat_<T_>::triangle ( const Rectmat_< T_ > & Rect,
bool Low = true )
 

triangle(Rect, Low): copies the lower triangle of Rect to the calling object if Low is true (default) or the upper triangle if Low is false.

Rectmat must be square, otherwise Squarexc_ is thrown. The calling object is resized silently. Returns reference to calling object.

template<class T_>
size_t RazorBack::Symmat_<T_>::rno ( ) const [inline, virtual]
 

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

Reimplemented from RazorBack::Basemat_.

Definition at line 104 of file Symmat.hh.

template<class T_>
size_t RazorBack::Symmat_<T_>::cno ( ) const [inline, virtual]
 

Reimplemented from RazorBack::Basemat_.

Definition at line 105 of file Symmat.hh.

template<class T_>
vector< T_ >::const_iterator RazorBack::Symmat_<T_>::operator[] ( size_t Idx ) const [inline, virtual]
 

The C-style [] operator provides unchecked access.

It is assumed (but NOT TESTED) that when writing Sym[i][j], the condition i>=j is true. You have been warned.

Reimplemented from RazorBack::Basemat_.

Definition at line 112 of file Symmat.hh.

template<class T_>
vector< T_ >::iterator RazorBack::Symmat_<T_>::operator[]<T_> ( size_t Idx ) [inline, virtual]
 

Reimplemented from RazorBack::Basemat_.

Definition at line 114 of file Symmat.hh.

template<class T_>
const T_ & RazorBack::Symmat_<T_>::at ( size_t Ridx,
size_t Cidx ) const [inline]
 

at(Ridx, Cidx): does unchecked C indexing but Ridx and Cidx are swapped if Ridx<Cidx.

Definition at line 121 of file Symmat.hh.

template<class T_>
T_ & RazorBack::Symmat_<T_>::at ( size_t Ridx,
size_t Cidx ) [inline]
 

Definition at line 126 of file Symmat.hh.

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

The two-argument function call operator provides optional checked access when Check is true, and FORTRAN-style indexing when Ftnidx is true.

Indices are always swapped silently so that Sym(i,j) is Sym[j][i] when i<j. Throws Indexrangexc_ on error.

Reimplemented from RazorBack::Basemat_.

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

Reimplemented from RazorBack::Basemat_.

template<class T_>
void RazorBack::Symmat_<T_>::size ( size_t S )
 

size(S): changes the size of the calling object to S x S.

Nothing is done if the size parameter is the same as the current size or if it is 0. When the matrix "shrinks", then the upper left corner is preserved, when it grows, then the new rows and columns are padded with "zeroes" T_(0).

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

row(Idx): returns the Idx-th row as a Vector_ object safely.

row(Vec,Idx): sets the elements in the Idx-th row to the elements of the vector Vec, provided Idx is legal and Vec has the right number of elements. col(Idx) and col(Vec,Idx) do exactly the same (symmetry!).

Reimplemented from RazorBack::Basemat_.

Referenced by col().

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

Reimplemented from RazorBack::Basemat_.

template<class T_>
Vector_< T_ > RazorBack::Symmat_<T_>::col<T_> ( size_t Idx ) const [inline, virtual]
 

Reimplemented from RazorBack::Basemat_.

Definition at line 160 of file Symmat.hh.

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

Reimplemented from RazorBack::Basemat_.

Definition at line 161 of file Symmat.hh.

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

Simple scalar operations.

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

template<class T_>
Symmat_< T_ > & RazorBack::Symmat_<T_>::operator+= ( const Symmat_< T_ > & Mat )
 

Matrix addition and subtraction.

Dimexc_ is thrown on dimension mismatches.

template<class T_>
Symmat_<T_> RazorBack::Symmat_<T_>::operator+ ( const Symmat_< T_ > & Mat ) const
 

template<class T_>
Rectmat_<T_> RazorBack::Symmat_<T_>::operator+ ( const Rectmat_< T_ > & Mat ) const
 

template<class T_>
Symmat_<T_>& RazorBack::Symmat_<T_>::operator-= ( const Symmat_< T_ > & Mat )
 

template<class T_>
Symmat_<T_> RazorBack::Symmat_<T_>::operator- ( const Symmat_< T_ > & Mat ) const
 

template<class T_>
Rectmat_< T_ > RazorBack::Symmat_<T_>::operator * ( const Symmat_< T_ > & Mat ) const
 

Matrix*matrix and matrix*vector multiplication.

Mixed Symmat/Rectmat operators are provided to avoid conversions. Dimexc_ is thrown on dimension mismatches.

template<class T_>
Rectmat_<T_> RazorBack::Symmat_<T_>::operator * ( const Rectmat_< T_ > & Mat ) const
 

template<class T_>
Vector_<T_> RazorBack::Symmat_<T_>::operator * ( const Vector_< T_ > & Vec ) const
 

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

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

diag(Vec): sets the diagonal to the values in the Vector_ object Vec. If the dimensions don't match, a Dimexc_ exception is thrown.

Reimplemented from RazorBack::Basemat_.

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

Reimplemented from RazorBack::Basemat_.

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

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

Reimplemented from RazorBack::Basemat_.

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

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

Reimplemented from RazorBack::Basemat_.

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

I/O.

Reimplemented from RazorBack::Basemat_.

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

hidden methods.

Reimplemented from RazorBack::Basemat_.

template<class T_>
unsigned int RazorBack::Symmat_<T_>::tri_size ( unsigned int X ) [inline, static, protected]
 

Definition at line 217 of file Symmat.hh.

Referenced by Symmat_(), at(), and operator[]().


Member Data Documentation

template<class T_>
size_t RazorBack::Symmat_<T_>::Size [private]
 

Definition at line 53 of file Symmat.hh.


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