TBCI::Matrix< T > Class Template Reference

#include <matrix.h>

Inheritance diagram for TBCI::Matrix< T >:

Inheritance graph
[legend]
Collaboration diagram for TBCI::Matrix< T >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef T value_type
typedef T element_type
typedef T aligned_value_type

Public Member Functions

 Matrix (const unsigned d=0)
 Matrix (const unsigned r, const unsigned c)
 Matrix (const T &v, const unsigned r, const unsigned c)
 Matrix (const Vector< T > &v, const enum rowcolvec r=colvec)
 Matrix (const Matrix< T > &m)
 copy, does a real copy, as TM(M) is invoked (not TM(TM))
 Matrix (const TMatrix< T > &tm)
 alias
 Matrix (const TSMatrix< T > &ts)
 ~Matrix ()
template<typename U>
 Matrix (const Matrix< U > &m)
template<typename U>
 Matrix (const TMatrix< U > &tm)
tbci_traits< T >::const_refval_type operator() (const unsigned int, const unsigned int) const
 ro element access
T & operator() (const unsigned int, const unsigned int)
 rw element access
TVector< T > operator() (const unsigned int) const
 get row
Matrix< T > & operator= (const Matrix< T > &m)
 Assignment, non-resizing.
Matrix< T > & operator= (const TMatrix< T > &tm)
Matrix< T > & operator= (TSMatrix< T > ts)
Matrix< T > & operator= (const T &v)
Matrix< T > & resize (const unsigned r, const unsigned c)
Matrix< T > & resize (const unsigned d)
Matrix< T > & resize (const T &v, const unsigned r, const unsigned c)
Matrix< T > & resize (const Matrix< T > &m)
Matrix< T > & fill (const T &v=(T) 0)
 Fill matrix.
Matrix< T > & fill (const Vector< T > &v)
 Fill complete matrix by vector elements (m00, m01, ... m0C, m10, ...).
Matrix< T > & setunit (const T &f=(T) 1)
 Set to unit matrix (optionally scaled).
Matrix< T > & clear ()
 Clear matrix (fill with 0).
Matrix< T > & operator+= (const Matrix< T > &a)
Matrix< T > & operator-= (const Matrix< T > &a)
Matrix< T > & operator+= (TMatrix< T > a)
 arithmetics ...
Matrix< T > & operator-= (TMatrix< T > a)
Matrix< T > & operator+= (TSMatrix< T > a)
Matrix< T > & operator-= (TSMatrix< T > a)
Matrix< T > & operator+= (const T &a)
Matrix< T > & operator-= (const T &a)
Matrix< T > & operator*= (const T &a)
Matrix< T > & operator/= (const T &a)
TMatrix< T > operator- () const
TMatrix< T > operator+ (const Matrix< T > &) const
TMatrix< T > operator- (const Matrix< T > &) const
TMatrix< T > operator* (const Matrix< T > &) const
TMatrix< T > & operator+ (TMatrix< T > &) const
TMatrix< T > & operator- (TMatrix< T > &) const
TMatrix< T > operator* (TMatrix< T > &) const
TMatrix< T > operator+ (TSMatrix< T > &) const
TMatrix< T > operator- (TSMatrix< T > &) const
TMatrix< T > operator* (TSMatrix< T > &) const
TMatrix< T > operator+ (const T &) const
TMatrix< T > operator- (const T &) const
TSMatrix< T > operator* (const T &) const
TSMatrix< T > operator/ (const T &) const
TVector< T > operator* (const Vector< T > &) const
TVector< T > operator* (TVector< T >) const
 Now for the Matrix-Vector multiplications.
TVector< T > operator* (const TSVector< T > &tsv) const
TVector< T > transMult (const Vector< T > &) const
bool operator== (const Matrix< T > &m) const
bool operator!= (const Matrix< T > &m) const
bool operator== (TMatrix< T > tm) const
bool operator!= (TMatrix< T > tm) const
bool operator== (TSMatrix< T >) const
bool operator!= (TSMatrix< T > ts) const
Matrix< T > & mult_rows (const Vector< T > &)
 Elementwise ops.
Matrix< T > & div_rows (const Vector< T > &)
Matrix< T > & mult_row (const T &, const unsigned)
Matrix< T > & div_row (const T &, const unsigned)
double fabssqr () const
 Sum over all squared elements.
double fabs () const

Static Public Member Functions

static const char * mat_info ()

Friends

class TSMatrix< T >
BVector< T > & bvfillm (BVector< T > &, const Matrix< T > &m)
std::ostream & operator (std::ostream &, const Matrix< T > &)
std::istream & operator>> (std::istream &, Matrix< T > &)
char gaussj (Matrix< T > &, Matrix< T > &)


Detailed Description

template<typename T>
class TBCI::Matrix< T >

Real, user referable, Matrix Does implement high performance arithmetics, together with TMatrix and TSMatrix. All objects that the user creates should be of class Matrix; the temporary objects are emitted by the compiler as suitable.

The implementation is NOT optimized for sparse matrices; please have a look at BdMatrix and CSCMatrix if you want to do computations with sparse matrices.

Definition at line 1561 of file matrix.h.


Member Typedef Documentation

template<typename T>
typedef T TBCI::Matrix< T >::value_type

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1568 of file matrix.h.

template<typename T>
typedef T TBCI::Matrix< T >::element_type

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1569 of file matrix.h.

template<typename T>
typedef T TBCI::Matrix< T >::aligned_value_type

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1570 of file matrix.h.


Constructor & Destructor Documentation

template<typename T>
TBCI::Matrix< T >::Matrix ( const unsigned  d = 0  )  [inline, explicit]

Definition at line 1574 of file matrix.h.

template<typename T>
TBCI::Matrix< T >::Matrix ( const unsigned  r,
const unsigned  c 
) [inline]

Definition at line 1577 of file matrix.h.

template<typename T>
TBCI::Matrix< T >::Matrix ( const T &  v,
const unsigned  r,
const unsigned  c 
) [inline]

Definition at line 1580 of file matrix.h.

template<typename T>
TBCI::Matrix< T >::Matrix ( const Vector< T > &  v,
const enum rowcolvec  r = colvec 
) [inline]

Definition at line 1583 of file matrix.h.

template<typename T>
TBCI::Matrix< T >::Matrix ( const Matrix< T > &  m  )  [inline]

copy, does a real copy, as TM(M) is invoked (not TM(TM))

Definition at line 1588 of file matrix.h.

template<typename T>
TBCI::Matrix< T >::Matrix ( const TMatrix< T > &  tm  )  [inline]

alias

Definition at line 1592 of file matrix.h.

template<typename T>
TBCI::Matrix< T >::Matrix ( const TSMatrix< T > &  ts  )  [inline]

Definition at line 1595 of file matrix.h.

template<typename T>
TBCI::Matrix< T >::~Matrix (  )  [inline]

Definition at line 1599 of file matrix.h.

template<typename T>
template<typename U>
TBCI::Matrix< T >::Matrix ( const Matrix< U > &  m  )  [inline, explicit]

Definition at line 1606 of file matrix.h.

template<typename T>
template<typename U>
TBCI::Matrix< T >::Matrix ( const TMatrix< U > &  tm  )  [inline, explicit]

Definition at line 1610 of file matrix.h.


Member Function Documentation

template<typename T>
static const char* TBCI::Matrix< T >::mat_info (  )  [inline, static]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1602 of file matrix.h.

template<typename T>
tbci_traits< T >::const_refval_type TBCI::Matrix< T >::operator() ( const unsigned int  i,
const unsigned int  j 
) const [inline]

ro element access

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1762 of file matrix.h.

References BCHK, TBCI::TMatrix< T >::col, TBCI::TMatrix< T >::mat, and TBCI::TMatrix< T >::row.

template<typename T>
T & TBCI::Matrix< T >::operator() ( const unsigned int  i,
const unsigned int  j 
) [inline]

rw element access

Definition at line 1770 of file matrix.h.

References BCHK, TBCI::TMatrix< T >::col, TBCI::TMatrix< T >::mat, and TBCI::TMatrix< T >::row.

template<typename T>
TVector< T > TBCI::Matrix< T >::operator() ( const unsigned int  i  )  const [inline]

get row

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1778 of file matrix.h.

References BCHK, TBCI::TMatrix< T >::col, TBCI::TMatrix< T >::row, T, TBCICOPY, and TBCI::BVector< T >::vec.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator= ( const Matrix< T > &  m  )  [inline]

Assignment, non-resizing.

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1625 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator= ( const TMatrix< T > &  tm  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1627 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator= ( TSMatrix< T >  ts  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1629 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator= ( const T &  v  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1631 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::resize ( const unsigned  r,
const unsigned  c 
) [inline]

Definition at line 1634 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::resize ( const unsigned  d  )  [inline]

Definition at line 1636 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::resize ( const T &  v,
const unsigned  r,
const unsigned  c 
) [inline]

Definition at line 1638 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::resize ( const Matrix< T > &  m  )  [inline]

Definition at line 1640 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::fill ( const T &  val = (T) 0  )  [inline]

Fill matrix.

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1642 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::fill ( const Vector< T > &  v  )  [inline]

Fill complete matrix by vector elements (m00, m01, ... m0C, m10, ...).

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1644 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::setunit ( const T &  fac = (T) 1  )  [inline]

Set to unit matrix (optionally scaled).

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1646 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::clear (  )  [inline]

Clear matrix (fill with 0).

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1648 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator+= ( const Matrix< T > &  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1658 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator-= ( const Matrix< T > &  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1660 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator+= ( TMatrix< T >  a  )  [inline]

arithmetics ...

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1662 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator-= ( TMatrix< T >  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1664 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator+= ( TSMatrix< T >  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1666 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator-= ( TSMatrix< T >  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1668 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator+= ( const T &  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1670 of file matrix.h.

template<typename T>
Matrix<T>& TBCI::Matrix< T >::operator-= ( const T &  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1672 of file matrix.h.

template<typename T>
Matrix< T > & TBCI::Matrix< T >::operator*= ( const T &  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1837 of file matrix.h.

References TBCI::TMatrix< T >::dim, STD_SMP_TEMPLATE2C, and TBCI::TMatrix< T >::vec.

template<typename T>
Matrix< T > & TBCI::Matrix< T >::operator/= ( const T &  a  )  [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1843 of file matrix.h.

References TBCI::TMatrix< T >::dim, STD_SMP_TEMPLATE2C, and TBCI::TMatrix< T >::vec.

template<typename T>
TMatrix<T> TBCI::Matrix< T >::operator- (  )  const [inline]

Definition at line 1681 of file matrix.h.

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator+ ( const Matrix< T > &  a  )  const [inline]

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator- ( const Matrix< T > &  a  )  const [inline]

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator* ( const Matrix< T > &  b  )  const [inline]

template<typename T>
TMatrix< T > & TBCI::Matrix< T >::operator+ ( TMatrix< T > &  a  )  const [inline]

template<typename T>
TMatrix< T > & TBCI::Matrix< T >::operator- ( TMatrix< T > &  a  )  const [inline]

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator* ( TMatrix< T > &  a  )  const [inline]

Definition at line 2017 of file matrix.h.

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator+ ( TSMatrix< T > &  ts  )  const [inline]

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator- ( TSMatrix< T > &  ts  )  const [inline]

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator* ( TSMatrix< T > &  a  )  const [inline]

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator+ ( const T &  a  )  const [inline]

template<typename T>
TMatrix< T > TBCI::Matrix< T >::operator- ( const T &  a  )  const [inline]

template<typename T>
TSMatrix< T > TBCI::Matrix< T >::operator* ( const T &  a  )  const [inline]

Definition at line 1867 of file matrix.h.

template<typename T>
TSMatrix< T > TBCI::Matrix< T >::operator/ ( const T &  a  )  const [inline]

Definition at line 1871 of file matrix.h.

References BCHK, and T.

template<typename T>
TVector< T > TBCI::Matrix< T >::operator* ( const Vector< T > &  v  )  const [inline]

template<typename T>
TVector< T > TBCI::Matrix< T >::operator* ( TVector< T >  c  )  const [inline]

Now for the Matrix-Vector multiplications.

These are time critical, because we use them in iterative solvers. Let's spend some braincells to optimize these, KG 8/98 -- 11/98

Definition at line 2104 of file matrix.h.

template<typename T>
TVector< T > TBCI::Matrix< T >::operator* ( const TSVector< T > &  tsv  )  const [inline]

template<typename T>
TVector< T > TBCI::Matrix< T >::transMult ( const Vector< T > &  v  )  const [inline]

template<typename T>
bool TBCI::Matrix< T >::operator== ( const Matrix< T > &  m  )  const [inline]

template<typename T>
bool TBCI::Matrix< T >::operator!= ( const Matrix< T > &  m  )  const [inline]

Definition at line 1709 of file matrix.h.

template<typename T>
bool TBCI::Matrix< T >::operator== ( TMatrix< T >  tm  )  const [inline]

Definition at line 1712 of file matrix.h.

template<typename T>
bool TBCI::Matrix< T >::operator!= ( TMatrix< T >  tm  )  const [inline]

Definition at line 1714 of file matrix.h.

template<typename T>
bool TBCI::Matrix< T >::operator== ( TSMatrix< T >  ts  )  const [inline]

template<typename T>
bool TBCI::Matrix< T >::operator!= ( TSMatrix< T >  ts  )  const [inline]

Definition at line 1718 of file matrix.h.

template<typename T>
Matrix< T > & TBCI::Matrix< T >::mult_rows ( const Vector< T > &  v  )  [inline]

template<typename T>
Matrix< T > & TBCI::Matrix< T >::div_rows ( const Vector< T > &  v  )  [inline]

template<typename T>
Matrix< T > & TBCI::Matrix< T >::mult_row ( const T &  f,
const unsigned  r 
) [inline]

Definition at line 2260 of file matrix.h.

References BCHK, TBCI::TMatrix< T >::col, and TBCI::TMatrix< T >::row.

Referenced by TBCI::Matrix< T >::div_row().

template<typename T>
Matrix< T > & TBCI::Matrix< T >::div_row ( const T &  d,
const unsigned  r 
) [inline]

template<typename T>
double TBCI::Matrix< T >::fabssqr (  )  const [inline]

Sum over all squared elements.

Reimplemented from TBCI::TMatrix< T >.

Definition at line 2085 of file matrix.h.

References TBCI::TMatrix< T >::dim, TBCI::do_vec_fabssqr(), LONG_DOUBLE, and TBCI::TMatrix< T >::vec.

Referenced by TBCI::fabssqr(), and TBCI::TMatrix< T >::fabssqr().

template<typename T>
double TBCI::Matrix< T >::fabs (  )  const [inline]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1739 of file matrix.h.

References TBCI::TSMatrix< T >::fabssqr(), GLBL__, MATH__, and sqrt().

Referenced by TBCI::GMRES().


Friends And Related Function Documentation

template<typename T>
friend class TSMatrix< T > [friend]

Reimplemented from TBCI::TMatrix< T >.

Definition at line 1566 of file matrix.h.

template<typename T>
BVector<T>& bvfillm ( BVector< T > &  bv,
const Matrix< T > &  m 
) [friend]

Definition at line 2221 of file matrix.h.

template<typename T>
std:: ostream& operator ( std::ostream &  ,
const Matrix< T > &   
) [friend]

template<typename T>
std:: istream& operator>> ( std::istream &  in,
Matrix< T > &  m 
) [friend]

Definition at line 1805 of file matrix.h.

template<typename T>
char gaussj ( Matrix< T > &  a,
Matrix< T > &  b 
) [friend]

Parameters:
a square n*n Matrix
b n*m Matrix, containing the Vectors to solve for
gauss-jordan linear algebraic equation solver with pivoting; Num.Rec. p.39
Returns:
a is inverted Matrix, b contains solution Vectors
Note:
The Matrices passed will be changed!

Definition at line 46 of file gauss_jordan.h.


The documentation for this class was generated from the following file:

Generated on Wed Nov 20 09:29:39 2013 for TBCI Numerical high perf. C++ Library by  doxygen 1.5.6