TBCI Numerical high perf. C++ Library 2.8.0
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  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)
#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.
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

◆ _COL

#define _COL   col

Definition at line 44 of file matrix.h.

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

◆ _DIM

#define _DIM   dim

Definition at line 42 of file matrix.h.

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

◆ _ENDVEC

#define _ENDVEC   endvec

Definition at line 41 of file matrix.h.

◆ _FAC

#define _FAC   fac

Definition at line 45 of file matrix.h.

◆ _ROW

#define _ROW   row

Definition at line 43 of file matrix.h.

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

◆ _VEC

#define _VEC   vec

Definition at line 40 of file matrix.h.

◆ COST_MATMAT

#define COST_MATMAT ( ra,
ca,
cb )
Value:
COST_MATMAT_NEW(ra,ca,cb)
#define COST_MATMAT_NEW(ra, ca, cb)
Definition matrix.h:1941

Definition at line 1946 of file matrix.h.

◆ COST_MATMAT_NEW

#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_LOOP
Definition cost.h:84
#define COST_MEMSET
Definition cost.h:56
#define COST_ADD
Definition cost.h:64
#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_UNIT_STORE
Definition cost.h:44
#define COST_MULT
Definition cost.h:72

Definition at line 1941 of file matrix.h.

◆ COST_MATMAT_OLD

#define COST_MATMAT_OLD ( ra,
ca,
cb )
Value:
#define COST_NU_LOAD
Definition cost.h:48

Definition at line 1939 of file matrix.h.

◆ NOFMA

#define NOFMA

Definition at line 2381 of file matrix.h.

◆ SMP_MATSLICE

#define SMP_MATSLICE   4096

Definition at line 96 of file matrix.h.

◆ SMP_MATSLICE2

#define SMP_MATSLICE2   (SMP_MATSLICE/sizeof(T))

Enumeration Type Documentation

◆ rowcolvec

enum rowcolvec
Enumerator
rowvec 
colvec 

Definition at line 70 of file matrix.h.

Function Documentation

◆ bvfillm()

template<typename T>
BVector< T > & bvfillm ( BVector< T > & bv,
const Matrix< T > & m )
inline

◆ do_fill_mat()

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.

Referenced by job_fill_mat(), and par_fill().

◆ do_mat_tsv_mult()

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 )

◆ do_mat_vec_mult()

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 )

◆ do_mat_vec_transmult()

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 )

◆ fabs() [1/3]

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

Definition at line 1105 of file matrix.h.

References fabs(), and TBCI__.

◆ fabs() [2/3]

template<typename T>
NAMESPACE_END NAMESPACE_CSTD double fabs ( const TBCI__ TMatrix< T > & tm)
inline

Definition at line 1100 of file matrix.h.

References fabs(), and TBCI__.

◆ fabs() [3/3]

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

Definition at line 1554 of file matrix.h.

References fabs(), TBCI__, and ts.

◆ fabssqr() [1/3]

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

Definition at line 2113 of file matrix.h.

References Matrix< T >::fabssqr().

◆ fabssqr() [2/3]

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

Definition at line 1054 of file matrix.h.

References TMatrix< T >::fabssqr().

Referenced by TSMatrix< T >::fabssqr().

◆ fabssqr() [3/3]

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

Definition at line 1543 of file matrix.h.

References TSMatrix< T >::fabssqr().

◆ INST()

INST ( template< typename T > class TMatrix friend void do_mat_mat_mult(const unsigned, const unsigned, TMatrix< T > *, const Matrix< T > *, const Matrix< T > *); )

Definition at line 1950 of file matrix.h.

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

◆ job_fill_mat()

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

Definition at line 2408 of file matrix.h.

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

Referenced by par_fill().

◆ job_mat_vec_mult()

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.

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

◆ job_mat_vec_transmult()

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.

Referenced by Matrix< T >::transMult().

◆ lu_decomp()

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, fabs(), TMatrix< T >::get(), TMatrix< T >::getcref(), i, LIKELY, MATH__, MAX, MIN, MIN_ALIGN2, MLU_MINVAL, PREFETCH_R, REGISTER, TMatrix< T >::rows(), TMatrix< T >::setval(), T, and UNLIKELY.

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

◆ numa_optimize()

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

Definition at line 2500 of file matrix.h.

◆ operator*() [1/3]

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

Definition at line 1043 of file matrix.h.

References a, b, T, and TMatrix< T >::TSMatrix< T >.

◆ operator*() [2/3]

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

Definition at line 1018 of file matrix.h.

References a, b, T, and TMatrix< T >::TSMatrix< T >.

◆ operator*() [3/3]

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

Definition at line 1525 of file matrix.h.

References T, and ts.

◆ operator+() [1/3]

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

Definition at line 1026 of file matrix.h.

References a, b, c, STD_SMP_TEMPLATE3VC, and T.

◆ operator+() [2/3]

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

Definition at line 1383 of file matrix.h.

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

◆ operator+() [3/3]

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

Definition at line 1003 of file matrix.h.

References a, b, STD_SMP_TEMPLATE2C, and T.

◆ operator-() [1/3]

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

Definition at line 1034 of file matrix.h.

References a, b, c, STD_SMP_TEMPLATE3VC, and T.

◆ operator-() [2/3]

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

Definition at line 1391 of file matrix.h.

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

◆ operator-() [3/3]

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

Definition at line 1010 of file matrix.h.

References a, b, STD_SMP_TEMPLATE2C, and T.

◆ operator<<() [1/3]

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

Definition at line 1801 of file matrix.h.

References c, TMatrix< T >::col, i, TMatrix< T >::row, and STD__.

◆ operator<<() [2/3]

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

Definition at line 1839 of file matrix.h.

References STD__, and ts.

◆ operator<<() [3/3]

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

Definition at line 1831 of file matrix.h.

References STD__.

◆ operator>>()

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, TMatrix< T >::row, TMatrix< T >::set_row(), and STD__.

◆ par_fill()

template<typename T>
void par_fill ( Matrix< T > & mat,
mat_fill_fn< T > fn,
void * par )

◆ transpose()

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

Definition at line 1073 of file matrix.h.

References TMatrix< T >::transposed_copy().