TBCI Numerical high perf. C++ Library  2.8.0
Classes | Macros | Enumerations | Functions
matrix.h File Reference

Implementation of classes TBCI::Matrix, TBCI::TMatrix, TBCI::TSMatrix. More...

#include "tbci/basics.h"
#include "tbci/vector.h"
#include "tbci/matrix_sig.h"
#include "matrix_kernels.h"
Include dependency graph for matrix.h:

Go to the source code of this file.

Classes

class  MatErr
 exception class More...
 
class  Matrix< T >
 
class  TMatrix< T >
 
class  TSMatrix< T >
 
class  Mat_Brack< T >
 
class  BdMatrix< T >
 The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band structure. More...
 
class  Tensor< T >
 Tensor class including arithmetics. More...
 
class  TMatrix< T >
 
class  TSMatrix< T >
 
class  Matrix< T >
 
class  Mat_Brack< T >
 
class  mat_fill_fn< T >
 

Macros

#define _VEC   vec
 
#define _ENDVEC   endvec
 
#define _DIM   dim
 
#define _ROW   row
 
#define _COL   col
 
#define _FAC   fac
 
#define SMP_MATSLICE   4096
 
#define SMP_MATSLICE2   (SMP_MATSLICE/sizeof(T))
 
#define COST_MATMAT_OLD(ra, ca, cb)
 
#define COST_MATMAT_NEW(ra, ca, cb)
 
#define COST_MATMAT(ra, ca, cb)   COST_MATMAT_NEW(ra,ca,cb)
 
#define NOFMA
 

Enumerations

enum  rowcolvec { rowvec = 0, colvec = 1 }
 

Functions

template<typename T >
void do_mat_vec_mult (const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_mat_tsv_mult (const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const TSVector< T > *vec)
 
template<typename T >
void do_mat_vec_transmult (const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
TMatrix< Toperator+ (const T &a, TMatrix< T > b)
 
template<typename T >
TMatrix< Toperator- (const T &a, TMatrix< T > b)
 
template<typename T >
TSMatrix< Toperator* (const T &a, TMatrix< T > b)
 
template<typename T >
TMatrix< Toperator+ (const T &a, const Matrix< T > &b)
 
template<typename T >
TMatrix< Toperator- (const T &a, const Matrix< T > &b)
 
template<typename T >
TSMatrix< Toperator* (const T &a, const Matrix< T > &b)
 
template<typename T >
double fabssqr (const TMatrix< T > &tm)
 
template<typename T >
TMatrix< Ttranspose (const TMatrix< T > &tm)
 
template<typename T >
NAMESPACE_END NAMESPACE_CSTD double fabs (const TBCI__ TMatrix< T > &tm)
 
template<typename T >
double fabs (const TBCI__ Matrix< T > &m)
 
template<typename T >
TMatrix< Toperator+ (const T &a, const TSMatrix< T > &ts)
 
template<typename T >
TMatrix< Toperator- (const T &a, const TSMatrix< T > &ts)
 
template<typename T >
TSMatrix< Toperator* (const T &f, TSMatrix< T > ts)
 
template<typename T >
double fabssqr (TSMatrix< T > &tsm)
 
template<typename T >
NAMESPACE_END NAMESPACE_CSTD double fabs (TBCI__ TSMatrix< T > &ts)
 
template<typename T >
STD__ ostream & operator<< (STD__ ostream &os, const Matrix< T > &m)
 
template<typename T >
STD__ istream & operator>> (STD__ istream &in, Matrix< T > &m)
 
template<typename T >
STD__ ostream & operator<< (STD__ ostream &os, TMatrix< T > tm)
 
template<typename T >
STD__ ostream & operator<< (STD__ ostream &os, const TSMatrix< T > &ts)
 
 INST (template< typename T > class TMatrix friend void do_mat_mat_mult(const unsigned, const unsigned, TMatrix< T > *, const Matrix< T > *, const Matrix< T > *);) template< typename T > inline void job_mat_mat_mult(struct thr_ctrl *tc)
 
template<typename T >
double fabssqr (const Matrix< T > &m)
 
template<typename T >
void job_mat_vec_mult (struct thr_ctrl *tc)
 
template<typename T >
void job_mat_vec_transmult (struct thr_ctrl *tc)
 
template<typename T >
BVector< T > & bvfillm (BVector< T > &bv, const Matrix< T > &m)
 
template<typename T >
int lu_decomp (Matrix< T > &) HOT
 LU decomposes the TBCI::Matrix mat. More...
 
template<typename T >
void do_fill_mat (const unsigned firstrow, const unsigned lastrow, Matrix< T > *mat, mat_fill_fn< T > fn, void *par)
 
template<typename T >
void job_fill_mat (struct thr_ctrl *tc)
 
template<typename T >
void par_fill (Matrix< T > &mat, mat_fill_fn< T > fn, void *par)
 
template<typename T >
int numa_optimize (const Matrix< T > &m, bool fault_in)
 

Detailed Description

Implementation of classes TBCI::Matrix, TBCI::TMatrix, TBCI::TSMatrix.

Definition in file matrix.h.

Macro Definition Documentation

#define _COL   col

Definition at line 44 of file matrix.h.

#define _DIM   dim

Definition at line 42 of file matrix.h.

#define _ENDVEC   endvec

Definition at line 41 of file matrix.h.

#define _FAC   fac

Definition at line 45 of file matrix.h.

#define _ROW   row

Definition at line 43 of file matrix.h.

#define _VEC   vec

Definition at line 40 of file matrix.h.

#define COST_MATMAT (   ra,
  ca,
  cb 
)    COST_MATMAT_NEW(ra,ca,cb)

Definition at line 1946 of file matrix.h.

#define COST_MATMAT_NEW (   ra,
  ca,
  cb 
)
Value:
/*+COST_CALL*/+cb*(3*COST_UNIT_LOAD/*+COST_CALL*/+COST_UNIT_STORE+COST_ADD+COST_MULT+COST_LOOP)))
#define COST_MULT
Definition: cost.h:72
#define COST_UNIT_STORE
Definition: cost.h:44
#define COST_MEMSET
Definition: cost.h:56
#define COST_UNIT_LOAD
There are several basic operations which are assigned a relative cost: (a good choice is to use twice...
Definition: cost.h:40
#define COST_ADD
Definition: cost.h:64
#define COST_LOOP
Definition: cost.h:84

Definition at line 1941 of file matrix.h.

#define COST_MATMAT_OLD (   ra,
  ca,
  cb 
)
Value:
#define COST_MULT
Definition: cost.h:72
#define COST_NU_LOAD
Definition: cost.h:48
#define COST_UNIT_STORE
Definition: cost.h:44
#define COST_UNIT_LOAD
There are several basic operations which are assigned a relative cost: (a good choice is to use twice...
Definition: cost.h:40
#define COST_ADD
Definition: cost.h:64
#define COST_LOOP
Definition: cost.h:84

Definition at line 1939 of file matrix.h.

#define NOFMA

Definition at line 2381 of file matrix.h.

#define SMP_MATSLICE   4096

Definition at line 96 of file matrix.h.

#define SMP_MATSLICE2   (SMP_MATSLICE/sizeof(T))

Definition at line 99 of file matrix.h.

Referenced by Matrix< T >::operator*(), par_fill(), and Matrix< T >::transMult().

Enumeration Type Documentation

enum rowcolvec
Enumerator
rowvec 
colvec 

Definition at line 70 of file matrix.h.

Function Documentation

template<typename T >
BVector<T>& bvfillm ( BVector< T > &  bv,
const Matrix< T > &  m 
)
inline
template<typename T >
void do_fill_mat ( const unsigned  firstrow,
const unsigned  lastrow,
Matrix< T > *  mat,
mat_fill_fn< T fn,
void *  par 
)

Definition at line 2396 of file matrix.h.

References c, TMatrix< T >::columns(), mat_fill_fn< T >::fn, and REGISTER.

template<typename T >
void do_mat_tsv_mult ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const Matrix< T > *  mat,
const TSVector< T > *  vec 
)
template<typename T >
void do_mat_vec_mult ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const Matrix< T > *  mat,
const Vector< T > *  vec 
)
template<typename T >
void do_mat_vec_transmult ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const Matrix< T > *  mat,
const Vector< T > *  vec 
)
template<typename T >
NAMESPACE_END NAMESPACE_CSTD double fabs ( const TBCI__ TMatrix< T > &  tm)
inline

Definition at line 1100 of file matrix.h.

References TMatrix< T >::fabs(), INST(), and TBCI__.

template<typename T >
double fabs ( const TBCI__ Matrix< T > &  m)
inline

Definition at line 1105 of file matrix.h.

References NAMESPACE_CSTD_END, and NAMESPACE_TBCI.

template<typename T >
NAMESPACE_END NAMESPACE_CSTD double fabs ( TBCI__ TSMatrix< T > &  ts)

Definition at line 1554 of file matrix.h.

References NAMESPACE_CSTD_END, and NAMESPACE_TBCI.

template<typename T >
double fabssqr ( const TMatrix< T > &  tm)
inline

Definition at line 1054 of file matrix.h.

References TMatrix< T >::fabssqr().

Referenced by TMatrix< T >::fabs(), and TMatrix< T >::resize().

template<typename T >
double fabssqr ( TSMatrix< T > &  tsm)
inline
template<typename T >
double fabssqr ( const Matrix< T > &  m)
inline

Definition at line 2113 of file matrix.h.

References Matrix< T >::fabssqr().

INST ( template< typename T > class TMatrix friend void do_mat_mat_mult(const unsigned, const unsigned, TMatrix< T > *, const Matrix< T > *, const Matrix< T > *);  )
template<typename T >
void job_fill_mat ( struct thr_ctrl tc)
inline

Definition at line 2408 of file matrix.h.

References thr_ctrl::t_off, thr_ctrl::t_par, and thr_ctrl::t_size.

template<typename T >
void job_mat_vec_mult ( struct thr_ctrl tc)
inline

Definition at line 2134 of file matrix.h.

References do_mat_vec_mult(), thr_ctrl::t_off, thr_ctrl::t_par, and thr_ctrl::t_size.

template<typename T >
void job_mat_vec_transmult ( struct thr_ctrl tc)
inline

Definition at line 2142 of file matrix.h.

References do_mat_vec_transmult(), thr_ctrl::t_off, thr_ctrl::t_par, and thr_ctrl::t_size.

template<typename T >
int lu_decomp ( Matrix< T > &  mat)

LU decomposes the TBCI::Matrix mat.

Decomposition is compactly stored in one Matrix The diagonal elements of the lower Matrix are all 1 (this is a feature of the algorithm).

Note
The Matrix passed will be changed!

Definition at line 94 of file lu_solver.h.

References ALIGN2, BCHK, TMatrix< T >::columns(), EL_PER_CL, err, std::fabs(), TMatrix< T >::get(), TMatrix< T >::getcref(), i, INST, LIKELY, LU_fwd_subst(), MATH__, MAX, MIN, MIN_ALIGN2, MLU_MINVAL, PREFETCH_R, REGISTER, TMatrix< T >::rows(), TMatrix< T >::setval(), T, and UNLIKELY.

Referenced by lu_det(), lu_invert(), lu_solve(), and BdMatrix< T >::setoutopts().

template<typename T >
int numa_optimize ( const Matrix< T > &  m,
bool  fault_in 
)

Definition at line 2500 of file matrix.h.

References NAMESPACE_END.

Referenced by par_fill().

template<typename T >
TSMatrix<T> operator* ( const T a,
TMatrix< T b 
)
inline

Definition at line 1018 of file matrix.h.

References a, b, INST(), and T.

Referenced by TMatrix< T >::TMatrix().

template<typename T >
TSMatrix<T> operator* ( const T a,
const Matrix< T > &  b 
)
inline

Definition at line 1043 of file matrix.h.

References a, and b.

template<typename T >
TSMatrix<T> operator* ( const T f,
TSMatrix< T ts 
)
inline

Definition at line 1525 of file matrix.h.

References ts.

template<typename T >
TMatrix<T> operator+ ( const T a,
TMatrix< T b 
)
inline

Definition at line 1003 of file matrix.h.

References b, INST(), STD_SMP_TEMPLATE2C, and T.

Referenced by TMatrix< T >::TMatrix().

template<typename T >
TMatrix<T> operator+ ( const T a,
const Matrix< T > &  b 
)
inline

Definition at line 1026 of file matrix.h.

References c, INST(), STD_SMP_TEMPLATE3VC, and T.

template<typename T >
TMatrix<T> operator+ ( const T a,
const TSMatrix< T > &  ts 
)
inline

Definition at line 1383 of file matrix.h.

References TSMatrix< T >::detach(), INST(), STD_SMP_TEMPLATE4C, and T.

template<typename T >
TMatrix<T> operator- ( const T a,
TMatrix< T b 
)
inline

Definition at line 1010 of file matrix.h.

References b, INST(), STD_SMP_TEMPLATE2C, and T.

Referenced by TMatrix< T >::TMatrix().

template<typename T >
TMatrix<T> operator- ( const T a,
const Matrix< T > &  b 
)
inline

Definition at line 1034 of file matrix.h.

References c, INST(), STD_SMP_TEMPLATE3VC, and T.

template<typename T >
TMatrix<T> operator- ( const T a,
const TSMatrix< T > &  ts 
)
inline

Definition at line 1391 of file matrix.h.

References TSMatrix< T >::detach(), STD_SMP_TEMPLATE4C, and T.

template<typename T >
STD__ ostream& operator<< ( STD__ ostream &  os,
const Matrix< T > &  m 
)

Definition at line 1801 of file matrix.h.

References c, and i.

template<typename T >
STD__ ostream& operator<< ( STD__ ostream &  os,
TMatrix< T tm 
)

Definition at line 1831 of file matrix.h.

References INST(), and STD__.

template<typename T >
STD__ ostream& operator<< ( STD__ ostream &  os,
const TSMatrix< T > &  ts 
)

Definition at line 1839 of file matrix.h.

References ts.

template<typename T >
STD__ istream& operator>> ( STD__ istream &  in,
Matrix< T > &  m 
)

Definition at line 1817 of file matrix.h.

References TMatrix< T >::col, i, INST(), TMatrix< T >::row, TMatrix< T >::set_row(), and STD__.

template<typename T >
void par_fill ( Matrix< T > &  mat,
mat_fill_fn< T fn,
void *  par 
)
template<typename T >
TMatrix<T> transpose ( const TMatrix< T > &  tm)
inline

Definition at line 1073 of file matrix.h.

References TMatrix< T >::transposed_copy().

Referenced by TMatrix< T >::operator*().