TBCI Numerical high perf. C++ Library  2.8.0
Classes | Macros | Functions
band_matrix.h File Reference
#include "tbci/basics.h"
#include "tbci/vector.h"
#include "tbci/matrix.h"
Include dependency graph for band_matrix.h:

Go to the source code of this file.

Classes

class  BdMatrixErr
 exception class More...
 
class  ILU0_BdMatrixPreconditioner< T >
 
class  DILU_BdMatrixPreconditioner< T >
 
class  BdMatrix< T >
 The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band structure. More...
 

Macros

#define BD_MINVAL   1e-16
 
#define BDMAT_ONE_BLOCK
 BDMAT_NEW_ALLOC directs BdMatrix to allocate off-diags separately. More...
 
#define BDMATDBG(x)
 
#define SFORALL_S(op)
 
#define SFORALL_T(op)
 
#define INTDIVEQ(T)
 
#define STDDEF_ST(op)
 
#define STDDEF_SS(op)
 
#define MAY_PREFETCH_R(adr, loc)   do {} while (0)
 
#define MAY_PREFETCH_W(adr, loc)   do {} while (0)
 
#define BDMATVEC_LNWISE_OPT
 
#define COST_BDMATVEC_LN(d, o, m)
 
#define COST_BDMATVEC_LNO(d, o, m)
 
#define COST_BDMATVEC_DIAG(d, o, m)
 
#define COST_BDMATVEC(d, o, m)   COST_BDMATVEC_LNO(d,o,m)
 
#define COST_BDMATVEC_TRANS(d, o, m)   COST_BDMATVEC(d,o,m)
 
#define COST_BDMATVEC_DOT(d, o, m)   COST_BDMATVEC(d,o,m)
 
#define SMP_BDMATSLICE   32768
 
#define SMP_BDMATSLICE2   (SMP_BDMATSLICE/sizeof(T))
 

Functions

template<typename T >
BdMatrix< Ttranspose (BdMatrix< T > &mat)
 
template<typename T >
BdMatrix< Toperator* (const T &v, const BdMatrix< T > &m)
 
template<typename T >
void do_bdmat_vec_mult_lnw (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_bdmat_vec_mult_lnw_opt (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_bdmat_vec_mult_diagw_exact (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_bdmat_vec_mult (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_bdmat_vec_transmult_lnw (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_bdmat_vec_transmult_lnw_opt (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_bdmat_vec_transmult_diagw_exact (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_bdmat_vec_transmult (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void do_bdmat_vec_dotmult (const unsigned start, const unsigned end, TVector< T > *res, const BdMatrix< T > *mat, const Vector< T > *vec)
 
template<typename T >
void job_bdmat_vec_mult (struct thr_ctrl *tc)
 
template<typename T >
void job_bdmat_vec_transmult (struct thr_ctrl *tc)
 
template<typename T >
STD__ ostream & operator<< (STD__ ostream &ostr, const BdMatrix< T > &mat)
 
template<typename T >
STD__ istream & operator>> (STD__ istream &istr, BdMatrix< T > &mat)
 
template<typename T >
int numa_optimize (const BdMatrix< T > &bm, bool fault_in)
 

Macro Definition Documentation

#define BD_MINVAL   1e-16

Definition at line 21 of file band_matrix.h.

Referenced by BdMatrix< T >::autoinsert(), and BdMatrix< T >::operator==().

#define BDMAT_ONE_BLOCK

BDMAT_NEW_ALLOC directs BdMatrix to allocate off-diags separately.

Definition at line 26 of file band_matrix.h.

#define BDMATDBG (   x)
#define BDMATVEC_LNWISE_OPT

Definition at line 1508 of file band_matrix.h.

#define COST_BDMATVEC (   d,
  o,
 
)    COST_BDMATVEC_LNO(d,o,m)

Definition at line 1915 of file band_matrix.h.

#define COST_BDMATVEC_DIAG (   d,
  o,
 
)
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_NU_STORE
Definition: cost.h:52
#define COST_LOOP
Definition: cost.h:84

Definition at line 1516 of file band_matrix.h.

#define COST_BDMATVEC_DOT (   d,
  o,
 
)    COST_BDMATVEC(d,o,m)

Definition at line 2291 of file band_matrix.h.

#define COST_BDMATVEC_LN (   d,
  o,
 
)
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_BRANCH
Definition: cost.h:88
#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 1512 of file band_matrix.h.

#define COST_BDMATVEC_LNO (   d,
  o,
 
)
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_BRANCH
Definition: cost.h:88
#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 1514 of file band_matrix.h.

#define COST_BDMATVEC_TRANS (   d,
  o,
 
)    COST_BDMATVEC(d,o,m)

Definition at line 1920 of file band_matrix.h.

#define INTDIVEQ (   T)
Value:
template <> \
{ \
BCHK((div==( T )0), BdMatrixErr, "Divide BdMatrix by zero", 0, *this); \
for (REGISTER unsigned i = 0; i < dim; ++i) \
diag[i] /= div; \
for (unsigned j = 0; j < diagconf.size(); ++j) { \
const REGISTER unsigned di = diagconf.get(j); \
for (unsigned k = 0; k < (dim-di); ++k) { \
adiag.set(di)[k] /= div; \
bdiag.set(di)[k] /= div; \
} \
} \
return *this; \
}
The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band str...
Definition: band_matrix.h:103
#define REGISTER
Definition: basics.h:108
#define BCHK(cond, exc, txt, ind, rtval)
Definition: basics.h:575
exception class
Definition: band_matrix.h:46
for(REGISTER T *p1=c.vec,*p2=b.vec;p1< c.endvec;p1++, p2++)*p1
return
Definition: LM_fit.h:82
int i
Definition: LM_fit.h:71
BdMatrix< T > & operator/=(const T &)
Definition: band_matrix.h:1340
#define T
Definition: bdmatlib.cc:20

Definition at line 1356 of file band_matrix.h.

#define MAY_PREFETCH_R (   adr,
  loc 
)    do {} while (0)
#define MAY_PREFETCH_W (   adr,
  loc 
)    do {} while (0)
#define SFORALL_S (   op)
Value:
template <typename T> \
{ \
BCHK(mat.dim != dim, BdMatrixErr, Adding wrong size BdMatrix, mat.dim, *this); \
unsigned i, j; \
for (i = 0; i < dim; ++i) \
diag[i] op mat.diag[i]; \
for (j = 0; j < diagconf.size(); ++j) { \
const REGISTER unsigned di = diagconf.get(j); \
if (LIKELY(mat.adiag.get(di))) \
for (i = 0; i < (dim-di); ++i) { \
adiag.set(di)[i] op mat.adiag.get(di)[i]; \
bdiag.set(di)[i] op mat.bdiag.get(di)[i]; \
} \
} \
if (diagconf == mat.diagconf) \
return *this; \
for (j = 0; j < mat.diagconf.size(); ++j) { \
const REGISTER unsigned di = mat.diagconf.get(j); \
if (!diagconf.contains(di)) { \
adddiag(di); \
for (i = 0; i < (dim-di); ++i) { \
adiag.set(di)[i] op mat.adiag.get(di)[i]; \
bdiag.set(di)[i] op mat.bdiag.get(di)[i]; \
} \
} \
} \
return *this; \
}
The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band str...
Definition: band_matrix.h:103
#define REGISTER
Definition: basics.h:108
unsigned int dim
Definition: band_matrix.h:109
#define BCHK(cond, exc, txt, ind, rtval)
Definition: basics.h:575
exception class
Definition: band_matrix.h:46
for(REGISTER T *p1=c.vec,*p2=b.vec;p1< c.endvec;p1++, p2++)*p1
return
Definition: LM_fit.h:82
if(value==0) return 1
NAMESPACE_TBCI BdMatrix< T >
Definition: bicg.h:20
int i
Definition: LM_fit.h:71
#define LIKELY(expr)
branch prediction note that we sometimes on purpose mark the unlikely possibility likely and vice ver...
Definition: basics.h:100

Definition at line 1283 of file band_matrix.h.

#define SFORALL_T (   op)
Value:
template <typename T> \
BdMatrix<T>& BdMatrix<T>::operator op (const T& mult) \
{ \
for (REGISTER unsigned int i = 0; i < dim; ++i) \
diag[i] op mult; \
for (unsigned j = 0; j < diagconf.size(); ++j) { \
const REGISTER unsigned di = diagconf.get(j); \
for (unsigned k = 0; k < (dim-di); ++k) { \
adiag.set(di)[k] op mult; \
bdiag.set(di)[k] op mult; \
} \
} \
return *this; \
}
The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band str...
Definition: band_matrix.h:103
#define REGISTER
Definition: basics.h:108
for(REGISTER T *p1=c.vec,*p2=b.vec;p1< c.endvec;p1++, p2++)*p1
return
Definition: LM_fit.h:82
NAMESPACE_TBCI BdMatrix< T >
Definition: bicg.h:20
int i
Definition: LM_fit.h:71
#define T
Definition: bdmatlib.cc:20

Definition at line 1318 of file band_matrix.h.

#define SMP_BDMATSLICE   32768

Definition at line 2508 of file band_matrix.h.

#define SMP_BDMATSLICE2   (SMP_BDMATSLICE/sizeof(T))

Definition at line 2510 of file band_matrix.h.

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

#define STDDEF_SS (   op)
Value:
template <typename T> \
{ \
return (BdMatrix<T> (*this)) op##= m2; \
}
The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band str...
Definition: band_matrix.h:103
return
Definition: LM_fit.h:82
NAMESPACE_TBCI BdMatrix< T >
Definition: bicg.h:20

Definition at line 1410 of file band_matrix.h.

#define STDDEF_ST (   op)
Value:
template <typename T> \
inline BdMatrix<T> BdMatrix<T>::operator op (const T& val) const \
{ \
return (BdMatrix<T> (*this)) op##= val; \
}
The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band str...
Definition: band_matrix.h:103
return
Definition: LM_fit.h:82
#define T
Definition: bdmatlib.cc:20

Definition at line 1398 of file band_matrix.h.

Function Documentation

template<typename T >
void do_bdmat_vec_dotmult ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void do_bdmat_vec_mult ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void do_bdmat_vec_mult_diagw_exact ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void do_bdmat_vec_mult_lnw ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void do_bdmat_vec_mult_lnw_opt ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void do_bdmat_vec_transmult ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void do_bdmat_vec_transmult_diagw_exact ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void do_bdmat_vec_transmult_lnw ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void do_bdmat_vec_transmult_lnw_opt ( const unsigned  start,
const unsigned  end,
TVector< T > *  res,
const BdMatrix< T > *  mat,
const Vector< T > *  vec 
)
inline
template<typename T >
void job_bdmat_vec_mult ( struct thr_ctrl tc)
template<typename T >
void job_bdmat_vec_transmult ( struct thr_ctrl tc)
template<typename T >
int numa_optimize ( const BdMatrix< T > &  bm,
bool  fault_in 
)

Definition at line 2915 of file band_matrix.h.

template<typename T >
BdMatrix<T> operator* ( const T v,
const BdMatrix< T > &  m 
)
inline

Definition at line 1449 of file band_matrix.h.

References v.

template<typename T >
STD__ ostream& operator<< ( STD__ ostream &  ostr,
const BdMatrix< T > &  mat 
)
template<typename T >
STD__ istream& operator>> ( STD__ istream &  istr,
BdMatrix< T > &  mat 
)
template<typename T >
BdMatrix<T> transpose ( BdMatrix< T > &  mat)
inline

Definition at line 1393 of file band_matrix.h.