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

RazorBack::Rectmat_ Class Template Reference

Class Rectmat_: a class of rectangular matrices (Row x Col). More...

#include <Rectmat.hh>

Inheritance diagram for RazorBack::Rectmat_:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 Rectmat_ (size_t Row=3, size_t Col=3)
 default ctor: 3x3 is the default size.

 Rectmat_ (const Rectmat_< T_ > &Rm)
 copy ctor.

 Rectmat_ (const T_ *Arr, size_t Row, size_t Col)
 init Rectmat_ with a conventional array. More...

virtual ~Rectmat_ ()
 destructor.

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)
virtual const T_& operator() (size_t Ridx, size_t Cidx) const
virtual T_& operator() (size_t Ridx, size_t Cidx)
void size (size_t Rno, size_t Cno)
 size(Rno, Cno): changes the size of the calling object to Rno x Cno. 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
 col(Idx): returns the Idx-th column as a Vector_ object safely. More...

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

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

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

Vector_<T_> operator * (const Vector_< T_ > &Vec) const
Rectmat_<T_> get_transpose () const
 get_transpose(): returns the transposed calling object.

Rectmat_<T_>& transpose_inplace ()
 transpose_inplace(): replaces the calling object with its transpose. More...

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. More...

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

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.


Private Attributes

size_t R
size_t C

Detailed Description

template<class T_> class RazorBack::Rectmat_

Class Rectmat_: a class of rectangular matrices (Row x Col).

Use for general matrices and for non-symmetric square matrices. Derived from Basemat_.

Definition at line 39 of file Rectmat.hh.


Constructor & Destructor Documentation

template<class T_>
RazorBack::Rectmat_<T_>::Rectmat_<T_> ( size_t Row = 3,
size_t Col = 3 ) [inline, explicit]
 

default ctor: 3x3 is the default size.

Definition at line 57 of file Rectmat.hh.

template<class T_>
RazorBack::Rectmat_<T_>::Rectmat_<T_> ( const Rectmat_< T_ > & Rm ) [inline]
 

copy ctor.

Definition at line 66 of file Rectmat.hh.

template<class T_>
RazorBack::Rectmat_<T_>::Rectmat_<T_> ( const T_ * Arr,
size_t Row,
size_t Col ) [inline]
 

init Rectmat_ with a conventional array.

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

Definition at line 73 of file Rectmat.hh.

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

destructor.

Definition at line 83 of file Rectmat.hh.


Member Function Documentation

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

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

Reimplemented from RazorBack::Basemat_.

Definition at line 88 of file Rectmat.hh.

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

Reimplemented from RazorBack::Basemat_.

Definition at line 89 of file Rectmat.hh.

Referenced by operator[]().

template<class T_>
vector< T_ >::const_iterator RazorBack::Rectmat_<T_>::operator[] ( size_t Idx ) const [inline, 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.

Reimplemented from RazorBack::Basemat_.

Definition at line 96 of file Rectmat.hh.

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

Reimplemented from RazorBack::Basemat_.

Definition at line 98 of file Rectmat.hh.

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

Reimplemented from RazorBack::Basemat_.

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

Reimplemented from RazorBack::Basemat_.

template<class T_>
void RazorBack::Rectmat_<T_>::size ( size_t Rno,
size_t Cno )
 

size(Rno, Cno): changes the size of the calling object to Rno x Cno.

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

template<class T_>
Vector_< T_ > RazorBack::Rectmat_<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.

Reimplemented from RazorBack::Basemat_.

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

Reimplemented from RazorBack::Basemat_.

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

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

col(Vec,Idx): sets the elements in the Idx-th column to the elements of the vector Vec, provided Idx is legal and Vec has the right number of elements.

Reimplemented from RazorBack::Basemat_.

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

Reimplemented from RazorBack::Basemat_.

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

Simple scalar operations.

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

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

Matrix addition and subtraction.

Dimexc_ is thrown on dimension mismatches.

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

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

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

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

Matrix*matrix and matrix*vector multiplication.

Dimexc_ is thrown on dimension mismatches.

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

template<class T_>
Rectmat_< T_ > RazorBack::Rectmat_<T_>::get_transpose ( ) const
 

get_transpose(): returns the transposed calling object.

template<class T_>
Rectmat_< T_ > & RazorBack::Rectmat_<T_>::transpose_inplace ( )
 

transpose_inplace(): replaces the calling object with its transpose.

Returns a reference to the calling object.

template<class T_>
Vector_< T_ > RazorBack::Rectmat_<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. If the calling object is not a square matrix, then Squarexc_ is thrown.

Reimplemented from RazorBack::Basemat_.

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

Reimplemented from RazorBack::Basemat_.

template<class T_>
void RazorBack::Rectmat_<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.

If the matrix is not square, a Squarexc_ exception is thrown.

Reimplemented from RazorBack::Basemat_.

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

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

If the matrix is not square, a Squarexc_ exception is thrown.

Reimplemented from RazorBack::Basemat_.

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

I/O.

Reimplemented from RazorBack::Basemat_.

template<class T_>
void RazorBack::Rectmat_<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_.


Member Data Documentation

template<class T_>
size_t RazorBack::Rectmat_<T_>::R [private]
 

Definition at line 51 of file Rectmat.hh.

template<class T_>
size_t RazorBack::Rectmat_<T_>::C [private]
 

Definition at line 51 of file Rectmat.hh.


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