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

Provides some macros which are used throughout the library files. More...

#include "tbci/tbci_version.h"
#include "tbci/config_manual.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cstring>
#include <cstdarg>
#include <cstdlib>
#include <cmath>
#include "tbci/except.h"
#include "perf_opt.h"
#include "tbci_traits.h"
#include "tbci_param.h"
#include "plain_def.h"
#include "malloc_cache.h"
#include "cost.h"
Include dependency graph for basics.h:

Go to the source code of this file.

Classes

class  TBCI::vec_fill_fn< T >
 

Namespaces

 TBCI
 The TBCI Numerical Library is put into TBCI namespace, if the compiler supports it (egcs-1.1.x and later for example)
 
 CPLX__
 
 std
 

Macros

#define HAVE_UNIX   1
 
#define USE_NS
 
#define SIGNATURE   class
 
#define RESTRICT
 
#define LIKELY(expr)   (expr)
 branch prediction note that we sometimes on purpose mark the unlikely possibility likely and vice versa to optimize the fast path. More...
 
#define UNLIKELY(expr)   (expr)
 
#define REGISTER   register
 
#define TBCI_DLLEXPORT
 
#define TBCI_DLLLOCAL
 
#define FGD
 
#define FGDT
 
#define FGDU
 
#define FGDTD
 
#define FGDDT
 
#define FGDCT
 
#define FGDR
 
#define ISTRINGSTREAM   istrstream
 strstream vs. s(tring)stream More...
 
#define OSTRINGSTREAM   ostrstream
 
#define STRINGSTREAM   strstream
 
#define LONG_DOUBLE   double
 
#define LONG_LONG   long
 
#define INST(x)
 
#define INST2(x, y)
 
#define INST3(x, y, z)
 
#define INST4(x, y, z, a)
 
#define INST5(x, y, z, a, b)
 
#define INST6(x, y, z, a, b, c)
 
#define NOINST
 
#define INSTCTL(x)
 
#define NULL   (0)
 
#define NAMESPACE_TBCI   namespace TBCI {
 
#define NAMESPACE_STD   namespace std {
 
#define NAMESPACE_CSTD   namespace std {
 
#define NAMESPACE_GRID   namespace Grid {
 
#define NAMESPACE_FD   namespace Finite_Difference {
 
#define NAMESPACE_CPLX   namespace std {
 
#define NAMESPACE_END   } /* namespace */
 
#define NAMESPACE_STD_END   } /* namespace std */
 
#define NAMESPACE_CSTD_END   } /* namespace std */
 
#define NAMESPACE_CPLX_END   } /* namespace std */
 
#define USING_TBCI   using namespace TBCI;
 
#define USING_GRID   using namespace Grid;
 
#define USING_FD   using namespace Finite_Difference;
 
#define USING_END   using namespace std; /* Don't use! */
 
#define USING_STD   using namespace std;
 
#define TBCI__   TBCI::
 
#define __TBCI__   ::TBCI::
 
#define FRIEND_TBCI__   /* */
 
#define FRIEND_TBCI2__   /* */
 
#define GRID__   Grid::
 
#define FD__   FD::
 
#define STD__   std::
 
#define MATH__   std::
 
#define CSTD__   std::
 
#define CPLX__   std::
 
#define GLBL__   /* not needed if ::std:: is used */
 
#define GLBL2__   /* not needed if ::TBCI:: is used */
 
#define ABORT_RET(x)   return x
 Note (KG, 2001-06-06): Eventually MATH__ and CSTD__ are the same on all systems and thus all MATH__ could be replaced by CSTD__ . More...
 
#define ABORT_RET_NR   do {} while (0)
 
#define MIN_ALIGN   8
 
#define MIN_ALIGN2   16
 
#define ALIGN3(v, i, x)   v(i)
 
#define ALIGN2(v, x)   v
 
#define ALIGN(x)
 
#define TALIGN(x)
 
#define CONSTA
 
#define TBCI_CONST(x)   x
 
#define REGPARMA(n)
 
#define REGPARM(n, x)   x
 
#define UNUSED
 
#define WEAKA
 
#define WEAK(x)   x
 
#define TWEAK(x)   x
 
#define HOT
 
#define COLD
 
#define HOTDECL(x)   x
 
#define COLDDECL(x)   x
 
#define __PRETTY_FUNCTION__   "<unknown>"
 
#define TBCIERRH1   __PRETTY_FUNCTION__
 
#define TBCIERRM(cond, exc, txt, ind)
 
#define TBCIERRS(cond, exc, txt, ind)
 
#define BCHK(cond, exc, txt, ind, rtval)
 
#define BCHKNR(cond, exc, txt, ind)
 
#define EXPCHK(cond, exc, txt, ind, rtval)   do {} while(0)
 
#define EXPCHKNR(cond, exc, txt, ind)   do {} while(0)
 
#define MIN(a, b)   ((a) < (b)? (a) : (b))
 
#define MAX(a, b)   ((a) > (b)? (a) : (b))
 
#define INFO(x)
 
#define RET(x)
 
#define CONSTR(x)   x
 
#define _VOID
 
#define INLINE   inline
 
#define OMP_FOR
 
#define OMP_FOR_REDUCE_F2
 
#define OMP_FOR_REDUCE_F1F2
 
#define PREFETCH_R(addr, loc)   do {} while (0)
 In case gcc does not yet support __builtin_prefetch(), we have handcoded assembly with gcc for a few architectures. More...
 
#define PREFETCH_W(addr, loc)   do {} while (0)
 
#define PREFETCH_R_MANY(addr, loc)   do {} while(0)
 
#define PREFETCH_W_MANY(addr, loc)   do {} while(0)
 
#define THREAD__
 
#define MAIN_PID   (getpid())
 
#define num_threads   (0)
 
#define thrno   (0)
 
#define ismainthread   (1)
 
#define VEC_INLINE   inline
 
#define COPY2(res, v1, f1, f2)   res = v1
 
#define TBCICOPY(n, o, t, s)   _par_copy < t > (s,n,o)
 
#define VEC_INLINE   /*inline*/
 
#define FILL1(res, f1, f2)   res = f2
 
#define TBCIFILL(n, v, t, s)   _par_fill < t > (s,n,v)
 
#define TBCICLEAR(n, t, s)   _par_fill < t > (s,n,t(0))
 
#define _TBCICOMP(n, o, t, s)
 
#define VEC_INLINE   /*inline*/
 
#define COMP2(r, v1, f1, f2)   if (r != v1) { ++f2; i = sz; goto _fin; /* break; */ }
 
#define TBCICOMP(n, o, t, s)   _par_comp< t > (s, n, o)
 
#define _REF_
 
#define FABSSQR(T)
 
#define FABS(T)
 
#define SQRT(T)
 
#define ABS(T)
 
#define VEC_INLINE
 

Typedefs

typedef enum _vararg TBCI::vararg
 

Enumerations

enum  TBCI::_vararg {
  TBCI::vag0 =0, TBCI::vag1, TBCI::vag2, TBCI::vag3,
  TBCI::vag4, TBCI::vag5, TBCI::vag6, TBCI::vag7,
  TBCI::vag8, TBCI::vag9, TBCI::vag10, TBCI::vag11,
  TBCI::vag12, TBCI::vag13, TBCI::vag14, TBCI::vag15,
  TBCI::vag16, TBCI::vag_max = 4294967295U
}
 This is a helper type to identify and count varargs. More...
 

Functions

template<typename T >
void TBCI::SWAP (T &a, T &b)
 SWAP function Note: We could implement a swap function without temporaries: a -= b b += a a -= b a = -a That's four arithmetic operations to save one temporary and it can be only done for integers. More...
 
template<typename T >
void TBCI::_tbci_copy (const unsigned long sz, T *const res, const T *const v1)
 
template<typename T >
void TBCI::_par_copy (const unsigned long sz, T *v1, const T *v2)
 
template<typename T >
void TBCI::_tbci_fill (const unsigned long sz, T *const res, register typename tbci_traits< T >::loop_const_refval_type f2)
 
template<typename T >
void TBCI::_par_fill (const unsigned long, T *const, typename tbci_traits< T >::loop_const_refval_type)
 
template<typename T >
void TBCI::_tbci_fill_fn (const unsigned long sz, T *vec, vec_fill_fn< T > fn, void *par)
 
template<typename T >
void TBCI::do_vv_comp (const unsigned long sz, const T *const v1, const T *const v2, volatile long &_f2)
 f2 = number of differences vec, vec More...
 
template<typename T >
int TBCI::_par_comp (const unsigned long sz, const T *v1, const T *v2)
 
template<typename T >
unsigned long TBCI::_bin_search (const T *vec, T el, unsigned long start, unsigned long end)
 Search for an element el in a sorted vector between start and end-1, returns (unsigned long)-1 if element is not found. More...
 
template<typename T >
unsigned long TBCI::bin_search (const T *vec, T el, unsigned long start, unsigned long end)
 Search for an element el in a sorted vector between start and end-1, returns (unsigned long)-1 if element is not found. More...
 
int std::conj (const int arg)
 conj for elementary types More...
 
unsigned std::conj (const unsigned arg)
 
long std::conj (const long arg)
 
short std::conj (const short arg)
 
char std::conj (const char arg)
 
float std::conj (const float arg)
 
double std::conj (const double arg)
 
int std::real (const int d)
 
unsigned std::real (const unsigned d)
 
float std::real (const float d)
 
double std::real (const double d)
 
int std::imag (const int d)
 
unsigned std::imag (const unsigned d)
 
float std::imag (const float d)
 
double std::imag (const double d)
 
template<typename T >
int TBCI::sign (const T &x)
 Signum. More...
 
double TBCI::fabssqr (const double a)
 
double TBCI::fabssqr (const float a)
 
double TBCI::fabssqr (const int a)
 
double TBCI::fabssqr (const unsigned a)
 
template<typename T >
T TBCI::sqr (const T &a)
 
template<typename T >
T TBCI::dot (const T &a1, const T &a2)
 
double std::fabs (const int a)
 
double std::sqrt (const int a)
 
double std::fabs (const unsigned int a)
 
unsigned std::abs (const unsigned a)
 

Detailed Description

Provides some macros which are used throughout the library files.

basics.h should be included from any file. It contains basics definitions and macros used thoughout the library code.

Note
This file should not be changed! Settings should be changed by passing defines to the compiler. See README file for docu about those defines: NO_NS ERRCHECK NO_EXCEPT ABORT_ON_ERR

The knowledge about compilers has been moved to config_manual.h, hooray! Next step will be to generate it with autoconf ...

The basics.h file is still a collection of awful stuff, but it's getting better.

Author
Kurt Garloff kurt@.nosp@m.garl.nosp@m.off.d.nosp@m.e
Date
9/1997 – 3/2006 License: GNU LGPL v2 or later
Version
Id:
basics.h,v 1.54.2.180 2022/11/03 23:52:52 garloff Exp

Definition in file basics.h.

Macro Definition Documentation

#define __PRETTY_FUNCTION__   "<unknown>"

Definition at line 515 of file basics.h.

#define __TBCI__   ::TBCI::

Definition at line 333 of file basics.h.

#define _REF_

Definition at line 1053 of file basics.h.

#define _TBCICOMP (   n,
  o,
  t,
 
)
Value:
({ \
REGISTER int _r; REGISTER unsigned long _i; \
for (_r=0, _i=0; _i<(s) && !_r; _i++) { \
_r = (int)((n)[_i] != (o)[_i]); \
if (_r) break; \
} \
_r; \
})
#define REGISTER
Definition: basics.h:108
for(REGISTER T *p1=c.vec,*p2=b.vec;p1< c.endvec;p1++, p2++)*p1
if(value==0) return 1

Definition at line 950 of file basics.h.

#define _VOID

Definition at line 682 of file basics.h.

#define ABORT_RET (   x)    return x

Note (KG, 2001-06-06): Eventually MATH__ and CSTD__ are the same on all systems and thus all MATH__ could be replaced by CSTD__ .

The difference to STD__ is that STD__ refers to the C++ stuff in the namespace std::, while the CSTD__ (and MATH__) refers to C stuff which is wrapped into std:: by including cXXX headers

Definition at line 412 of file basics.h.

#define ABORT_RET_NR   do {} while (0)

Definition at line 413 of file basics.h.

#define ABS (   T)
Value:
TBCI_CONST(inline T abs (const T a)) \
{ return a<(T)0?-a:a; }
#define TBCI_CONST(x)
Definition: basics.h:458
#define abs(x)
Definition: f2c.h:178
#define T
Definition: bdmatlib.cc:20
const unsigned TMatrix< T > const Matrix< T > * a

Definition at line 1239 of file basics.h.

#define ALIGN (   x)
#define ALIGN2 (   v,
  x 
)    v
#define ALIGN3 (   v,
  i,
  x 
)    v(i)
#define BCHK (   cond,
  exc,
  txt,
  ind,
  rtval 
)
Value:
/*if (UNLIKELY((cond) && __TBCI__ do_errcheck())) { */ \
if (UNLIKELY(__TBCI__ do_errcheck() && (cond))) { \
throw exc ((TBCIERRM(cond,exc,txt,ind)).c_str(), ind); \
STD__ cerr << TBCIERRS(cond,exc,txt,ind) << STD__ endl; \
abort(); \
return rtval; \
}
unsigned int do_abort()
Definition: tbci_param.h:148
#define __TBCI__
Definition: basics.h:333
#define UNLIKELY(expr)
Definition: basics.h:101
#define TBCIERRS(cond, exc, txt, ind)
Definition: basics.h:525
return
Definition: LM_fit.h:82
if(value==0) return 1
#define STD__
Definition: basics.h:338
unsigned int do_except()
Definition: tbci_param.h:149
#define TBCIERRM(cond, exc, txt, ind)
Definition: basics.h:521
unsigned int do_errcheck()
Definition: tbci_param.h:141

Definition at line 575 of file basics.h.

Referenced by BdMatrix< T >::adddiag(), tbci_memalloc_cache< T >::alloc(), BVector< T >::append(), BdMatrix< T >::autoinsert(), bvfillm(), CTensor< T >::calc_indx(), CTensor< T >::calc_offs(), cediv(), cemul(), BVector< T >::cheapdownsize(), TMatrix< T >::cheapdownsizerow(), Tensor< T >::cntrmul(), Tensor< T >::contract(), CSCMatrix< T >::cscm_vec_mul_exact(), ctrmul(), tbci_memalloc_cache< T >::dealloc(), BdMatrix< T >::div_row(), Matrix< T >::div_row(), BdMatrix< T >::div_rows(), Matrix< T >::div_rows(), do_fbdmat_vec_mul(), dot(), BdMatrix< T >::dotMult(), ediv(), emul(), BdMatrix< T >::expand(), TMatrix< T >::fill(), tbci_memalloc_cache< T >::find_by_sz(), gaussj(), F_BandMatrix< T >::get_col(), BdMatrix< T >::get_col(), TMatrix< T >::get_col(), CRMatrix< T >::get_row(), F_TMatrix< T >::get_row(), BdMatrix< T >::get_row(), CTensor< T >::getcref(), HOTDECL(), Index::idx_fill_in1(), Index::idx_fill_in2(), Index::idx_remove1(), Index::idx_remove2(), Index::idx_set1(), FS_Vector< dims, T >::incr(), TVector< T >::incr(), TSVector< T >::incr(), Vector< T >::incr(), tbci_memalloc_cache< T >::init(), LU_bkw_subst(), lu_decomp(), LU_det(), LU_fwd_subst(), LU_invert(), lu_solve(), Vector< T >::max(), metrmul(), Vector< T >::min(), CSCMatrix< T >::mult(), CSCMatrix< T >::mult1(), BdMatrix< T >::mult_row(), Matrix< T >::mult_row(), BdMatrix< T >::mult_rows(), Matrix< T >::mult_rows(), CSCMatrix< T >::multf(), Index::next_idx(), F_BandMatrix< T >::operator()(), FS_Vector< dims, T >::operator()(), CRMatrix< T >::operator()(), CTensor< T >::operator()(), F_TMatrix< T >::operator()(), F_Matrix< T >::operator()(), Matrix< T >::operator()(), CRMatrix< T >::operator*(), CSCMatrix< T >::operator*(), BdMatrix< T >::operator*(), F_TSMatrix< T >::operator*(), TSMatrix< T >::operator*(), F_Matrix< T >::operator*(), Vector< T >::operator*(), Matrix< T >::operator*(), TVector< T >::operator+(), CSCMatrix< T >::operator+(), TMatrix< T >::operator+(), Tensor< T >::operator+(), operator+(), TSVector< T >::operator+(), TSMatrix< T >::operator+(), Vector< T >::operator+(), Matrix< T >::operator+(), TVector< T >::operator+=(), TMatrix< T >::operator+=(), Tensor< T >::operator+=(), TVector< T >::operator-(), CSCMatrix< T >::operator-(), TMatrix< T >::operator-(), Tensor< T >::operator-(), operator-(), TSVector< T >::operator-(), TSMatrix< T >::operator-(), Vector< T >::operator-(), Matrix< T >::operator-(), TVector< T >::operator-=(), TMatrix< T >::operator-=(), Tensor< T >::operator-=(), FS_Vector< dims, T >::operator/(), F_TMatrix< T >::operator/(), TMatrix< T >::operator/(), operator/(), F_Matrix< T >::operator/(), Vector< T >::operator/(), Matrix< T >::operator/(), FS_Vector< dims, T >::operator/=(), TVector< T >::operator/=(), F_TMatrix< T >::operator/=(), TMatrix< T >::operator/=(), BdMatrix< T >::operator/=(), BVector< T >::operator<=(), F_BandMatrix< T >::operator=(), TVector< T >::operator=(), F_TMatrix< T >::operator=(), CRMatrix< T >::operator=(), BVector< T >::operator=(), TMatrix< T >::operator=(), BdMatrix< T >::operator=(), BVector< T >::operator>=(), FS_Vector< dims, T >::operator[](), Index::prev_idx(), BVector< T >::remove(), BVector< T >::resize(), CRMatrix< T >::setunit(), CSCMatrix< T >::setunit(), F_TMatrix< T >::setunit(), TMatrix< T >::setunit(), CRMatrix< T >::setval(), BdMatrix< T >::setval(), TVector< T >::slice(), slice(), Vector< T >::slice(), ILU0_BdMatrixPreconditioner< T >::solve(), thread_dereg_callback(), F_TMatrix< T >::trace(), TMatrix< T >::trace(), F_BandMatrix< T >::transMult(), CRMatrix< T >::transMult(), CSCMatrix< T >::transMult(), BdMatrix< T >::transMult(), Matrix< T >::transMult(), CTensor< T >::transpose(), DiagPreconditioner< T, MatrixType >::update(), DILU_BdMatrixPreconditioner< T >::update(), and ILU0_BdMatrixPreconditioner< T >::update().

#define BCHKNR (   cond,
  exc,
  txt,
  ind 
)
Value:
if (UNLIKELY(__TBCI__ do_errcheck() && (cond))) { \
throw exc ((TBCIERRM(cond,exc,txt,ind)).c_str(), ind); \
STD__ cerr << TBCIERRS(cond,exc,txt,ind) << STD__ endl; \
abort(); \
}
unsigned int do_abort()
Definition: tbci_param.h:148
#define __TBCI__
Definition: basics.h:333
#define UNLIKELY(expr)
Definition: basics.h:101
#define TBCIERRS(cond, exc, txt, ind)
Definition: basics.h:525
if(value==0) return 1
#define STD__
Definition: basics.h:338
unsigned int do_except()
Definition: tbci_param.h:149
#define TBCIERRM(cond, exc, txt, ind)
Definition: basics.h:521
unsigned int do_errcheck()
Definition: tbci_param.h:141

Definition at line 586 of file basics.h.

Referenced by _thread_start_off(), BdMatrix< T >::adddiag(), TMatrix< T >::alias(), CRMatrix< T >::allocate(), F_BandMatrix< T >::allocate(), CSCMatrix< T >::allocate(), BdMatrix< T >::BdMatrix(), BdMatrix< T >::constructor(), CRMatrix< T >::copy(), F_BandMatrix< T >::copy(), CSCMatrix< T >::copy(), F_BandMatrix< T >::F_BandMatrix(), FS_Vector< dims, T >::FS_Vector(), CSCMatrix< T >::insert(), CRMatrix< T >::MatVecMult(), CSCMatrix< T >::MatVecMult(), metrmul(), CTensor< T >::operator()(), F_BandMatrix< T >::set_col(), F_TMatrix< T >::set_col(), TMatrix< T >::set_col(), TMatrix< T >::set_col_partial(), CRMatrix< T >::set_row(), F_TMatrix< T >::set_row(), TMatrix< T >::set_row(), TMatrix< T >::set_row_partial(), F_BandMatrix< T >::setval(), DILU_BdMatrixPreconditioner< T >::solve(), thread_wait(), thread_wait_result(), TMatrix< T >::TMatrix(), and BdMatrix< T >::~BdMatrix().

#define COLD

Definition at line 496 of file basics.h.

#define COLDDECL (   x)    x

Definition at line 498 of file basics.h.

#define COMP2 (   r,
  v1,
  f1,
  f2 
)    if (r != v1) { ++f2; i = sz; goto _fin; /* break; */ }

Definition at line 973 of file basics.h.

#define CONSTA

Definition at line 457 of file basics.h.

#define CONSTR (   x)    x

Definition at line 675 of file basics.h.

#define COPY2 (   res,
  v1,
  f1,
  f2 
)    res = v1

Definition at line 890 of file basics.h.

#define CPLX__   std::
#define CSTD__   std::
#define EXPCHK (   cond,
  exc,
  txt,
  ind,
  rtval 
)    do {} while(0)
#define EXPCHKNR (   cond,
  exc,
  txt,
  ind 
)    do {} while(0)

Definition at line 631 of file basics.h.

Referenced by CSCMatrix< T >::setval().

#define FABS (   T)
Value:
TBCI_CONST(inline double fabs (const T a)) \
{ return a<(T)0?(double)-a:(double)a; }
double fabs(const int a)
Definition: basics.h:1215
#define TBCI_CONST(x)
Definition: basics.h:458
#define T
Definition: bdmatlib.cc:20
const unsigned TMatrix< T > const Matrix< T > * a

Definition at line 1200 of file basics.h.

#define FABSSQR (   T)
Value:
TBCI_CONST(inline double fabssqr (const T a)) \
{ return CPLX__ real(a * CPLX__ conj(a)); }
int conj(const int arg)
conj for elementary types
Definition: basics.h:1055
#define TBCI_CONST(x)
Definition: basics.h:458
#define CPLX__
Definition: basics.h:341
#define real
double fabssqr(const double a)
Definition: basics.h:1157
#define T
Definition: bdmatlib.cc:20
const unsigned TMatrix< T > const Matrix< T > * a

Definition at line 1153 of file basics.h.

#define FD__   FD::

Definition at line 337 of file basics.h.

#define FGD

Definition at line 144 of file basics.h.

#define FGDCT

Definition at line 149 of file basics.h.

#define FGDDT

Definition at line 148 of file basics.h.

#define FGDR

Definition at line 150 of file basics.h.

#define FGDT

Definition at line 145 of file basics.h.

#define FGDTD

Definition at line 147 of file basics.h.

#define FGDU

Definition at line 146 of file basics.h.

#define FILL1 (   res,
  f1,
  f2 
)    res = f2

Definition at line 906 of file basics.h.

#define FRIEND_TBCI2__   /* */

Definition at line 335 of file basics.h.

#define FRIEND_TBCI__   /* */

Definition at line 334 of file basics.h.

#define GLBL2__   /* not needed if ::TBCI:: is used */

Definition at line 343 of file basics.h.

Referenced by TSVector< T >::fabssqr(), and TSMatrix< T >::fabssqr().

#define GLBL__   /* not needed if ::std:: is used */
#define GRID__   Grid::

Definition at line 336 of file basics.h.

#define HAVE_UNIX   1

Definition at line 55 of file basics.h.

#define HOT

Definition at line 495 of file basics.h.

#define HOTDECL (   x )    x

Definition at line 497 of file basics.h.

#define INFO (   x)

Definition at line 664 of file basics.h.

#define INLINE   inline

Definition at line 688 of file basics.h.

#define INST (   x)

Definition at line 238 of file basics.h.

#define INST2 (   x,
  y 
)

Definition at line 239 of file basics.h.

#define INST3 (   x,
  y,
  z 
)

Definition at line 240 of file basics.h.

#define INST4 (   x,
  y,
  z,
  a 
)

Definition at line 241 of file basics.h.

#define INST5 (   x,
  y,
  z,
  a,
  b 
)

Definition at line 242 of file basics.h.

#define INST6 (   x,
  y,
  z,
  a,
  b,
  c 
)

Definition at line 243 of file basics.h.

#define INSTCTL (   x)

Definition at line 245 of file basics.h.

#define ismainthread   (1)

Definition at line 784 of file basics.h.

#define ISTRINGSTREAM   istrstream

strstream vs. s(tring)stream

Definition at line 204 of file basics.h.

#define LIKELY (   expr)    (expr)

branch prediction note that we sometimes on purpose mark the unlikely possibility likely and vice versa to optimize the fast path.

Definition at line 100 of file basics.h.

Referenced by TSVector< T >::add_t_tsv(), BdMatrix< T >::adddiag(), BdMatrix< T >::autoinsert(), BiCGSTAB(), BVector< T >::BVector(), BVector< unsigned >::BVector(), TMatrix< T >::cheapdownsizerow(), BdMatrix< T >::check_internal(), TSVector< T >::clone(), TSMatrix< T >::clone(), BdMatrix< T >::constructor(), BVector< T >::destroy(), TSVector< T >::destroy(), TSVector< T >::detach(), TSMatrix< T >::detach(), do_bdmat_vec_dotmult(), do_bdmat_vec_mult(), do_bdmat_vec_mult_lnw(), do_bdmat_vec_transmult_lnw(), dot(), BdMatrix< T >::expand(), F_TMatrix< T >::F_TMatrix(), Vector< T >::fabssqr(), tbci_memalloc_cache< T >::find_and_rmv(), tbci_memalloc_cache< T >::free_and_enter(), BdMatrix< T >::get(), BdMatrix< T >::get_col(), BdMatrix< T >::get_row(), HOTDECL(), lu_decomp(), Vector< T >::max(), Vector< T >::min(), BdMatrix< T >::operator()(), BdMatrix< T >::operator*(), Vector< T >::operator*(), Matrix< T >::operator*(), TVector< T >::operator+(), TSVector< T >::operator+(), TSMatrix< T >::operator+(), Vector< T >::operator+(), TVector< T >::operator+=(), TVector< T >::operator-(), TSVector< T >::operator-(), TSMatrix< T >::operator-(), Vector< T >::operator-(), TVector< T >::operator-=(), TVector< T >::operator=(), TVector< T >::operator==(), BVector< T >::operator==(), BdMatrix< T >::operator==(), TMatrix< T >::operator==(), TSVector< T >::operator==(), TSMatrix< T >::operator==(), Vector< T >::operator==(), Matrix< T >::operator==(), par_fill(), TSMatrix< T >::real_destroy(), BVector< T >::resize(), F_TMatrix< T >::resize(), TMatrix< T >::resize(), TMatrix< T >::row_expand(), TMatrix< T >::set_ptrs(), TMatrix< T >::setunit(), BdMatrix< T >::setval(), TBCI::sign(), ILU0_Symm_BdMatrixPreconditioner< T >::solve(), TSVector< T >::sub_t_tsv(), Vector< T >::sum(), cplx< T >::theta(), TMatrix< T >::TMatrix(), BdMatrix< T >::transMult(), Matrix< T >::transMult(), DILU_BdMatrixPreconditioner< T >::update(), and Vector< T >::Vector().

#define LONG_DOUBLE   double

Definition at line 219 of file basics.h.

#define LONG_LONG   long

Definition at line 224 of file basics.h.

#define MAIN_PID   (getpid())

Definition at line 781 of file basics.h.

#define MATH__   std::
#define MAX (   a,
  b 
)    ((a) > (b)? (a) : (b))
#define MIN (   a,
  b 
)    ((a) < (b)? (a) : (b))
#define MIN_ALIGN   8
#define MIN_ALIGN2   16
#define NAMESPACE_CPLX   namespace std {

Definition at line 322 of file basics.h.

#define NAMESPACE_CPLX_END   } /* namespace std */

Definition at line 326 of file basics.h.

#define NAMESPACE_CSTD   namespace std {

Definition at line 319 of file basics.h.

#define NAMESPACE_CSTD_END   } /* namespace std */

Definition at line 325 of file basics.h.

#define NAMESPACE_END   } /* namespace */

Definition at line 323 of file basics.h.

#define NAMESPACE_FD   namespace Finite_Difference {

Definition at line 321 of file basics.h.

#define NAMESPACE_GRID   namespace Grid {

Definition at line 320 of file basics.h.

#define NAMESPACE_STD   namespace std {

Definition at line 318 of file basics.h.

#define NAMESPACE_STD_END   } /* namespace std */

Definition at line 324 of file basics.h.

#define NAMESPACE_TBCI   namespace TBCI {

Definition at line 317 of file basics.h.

#define NOINST

Definition at line 244 of file basics.h.

#define NULL   (0)
#define num_threads   (0)

Definition at line 782 of file basics.h.

#define OMP_FOR

Definition at line 708 of file basics.h.

#define OMP_FOR_REDUCE_F1F2

Definition at line 710 of file basics.h.

#define OMP_FOR_REDUCE_F2

Definition at line 709 of file basics.h.

#define OSTRINGSTREAM   ostrstream

Definition at line 205 of file basics.h.

#define PREFETCH_R (   addr,
  loc 
)    do {} while (0)

In case gcc does not yet support __builtin_prefetch(), we have handcoded assembly with gcc for a few architectures.

Some preliminary results:

  • For AXP (21164A,EV56) it seems to harm performance a bit
  • For PentiumIII (Coppermine) it helps a lot
  • For AMD K7 (Athlon st.2) it seems to help a tiny bit

Definition at line 748 of file basics.h.

Referenced by busy_read(), do_bdmat_vec_dotmult(), do_bdmat_vec_mult_lnw_opt(), do_bdmat_vec_transmult_lnw_opt(), dot(), Vector< T >::fabssqr(), HOTDECL(), if(), lu_decomp(), Vector< T >::operator*(), Matrix< T >::operator*(), and Vector< T >::sum().

#define PREFETCH_R_MANY (   addr,
  loc 
)    do {} while(0)

Definition at line 764 of file basics.h.

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

#define PREFETCH_W (   addr,
  loc 
)    do {} while (0)

Definition at line 749 of file basics.h.

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

#define PREFETCH_W_MANY (   addr,
  loc 
)    do {} while(0)

Definition at line 765 of file basics.h.

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

#define REGISTER   register

Definition at line 108 of file basics.h.

Referenced by TBCI::_tbci_fill_fn(), BdMatrix< T >::autoinsert(), BdMatrix< T >::BdMatrix(), BVector< T >::bubble_sort(), CTensor< T >::calc_offs(), CTensor< T >::calclayout(), CTensor< T >::calcsize(), cediv(), cemul(), Chisq(), chisq(), F_TSMatrix< T >::clone(), TSVector< T >::clone(), conj(), BdMatrix< T >::constructor(), FS_Vector< dims, T >::contains(), BVector< T >::contains(), CSCMatrix< T >::cscm_vec_mul_exact(), F_TSMatrix< T >::detach(), TSMatrix< T >::detach(), cplx< T >::div(), do_bdmat_vec_dotmult(), do_bdmat_vec_mult_diagw_exact(), do_bdmat_vec_mult_lnw(), do_bdmat_vec_mult_lnw_opt(), do_bdmat_vec_transmult_diagw_exact(), do_bdmat_vec_transmult_lnw(), do_bdmat_vec_transmult_lnw_opt(), do_fill_mat(), dot(), ediv(), emul(), F_TSMatrix< T >::eval(), TSVector< T >::eval(), exact_sum(), expi(), F_TSMatrix< T >::fabs(), F_Matrix< T >::fabs(), gaussj(), CSCMatrix< T >::get(), BdMatrix< T >::get(), BdMatrix< T >::get_col(), TMatrix< T >::get_col(), F_TMatrix< T >::get_row(), BdMatrix< T >::get_row(), if(), imag(), kahan_sum(), lev_mar(), LM_fit_2D(), LU_bkw_subst(), lu_decomp(), LU_det(), LU_fwd_subst(), FS_Vector< dims, T >::max(), Vector< T >::max(), FS_Vector< dims, T >::min(), Vector< T >::min(), CSCMatrix< T >::mult(), CSCMatrix< T >::multf(), BdMatrix< T >::operator()(), CSCMatrix< T >::operator*(), BdMatrix< T >::operator*(), F_TSMatrix< T >::operator*(), TSMatrix< T >::operator*(), F_Matrix< T >::operator*(), Matrix< T >::operator*(), cplx< T >::operator*=(), F_TMatrix< T >::operator-(), BdMatrix< T >::operator-(), cplx< T >::operator/(), cplx< T >::operator/=(), BdMatrix< T >::operator/=(), F_TMatrix< T >::operator==(), TMatrix< T >::operator==(), F_TSMatrix< T >::operator==(), TSVector< T >::operator==(), TSMatrix< T >::operator==(), F_Matrix< T >::operator==(), Vector< T >::operator==(), Matrix< T >::operator==(), real(), BdMatrix< T >::reconfig(), BdMatrix< T >::resize(), BVector< T >::revert(), TMatrix< T >::row_expand(), TMatrix< T >::set_col(), TMatrix< T >::set_col_partial(), TMatrix< T >::set_ptrs(), F_TMatrix< T >::set_row(), F_TMatrix< T >::setunit(), TMatrix< T >::setunit(), BdMatrix< T >::setval(), ILU0_Symm_BdMatrixPreconditioner< T >::solve(), ILU0_BdMatrixPreconditioner< T >::solve(), sqr(), FS_Vector< dims, T >::sum(), TBCI::SWAP(), F_TMatrix< T >::trace(), BdMatrix< T >::trace(), TMatrix< T >::trace(), CSCMatrix< T >::transMult(), BdMatrix< T >::transpose(), and DILU_BdMatrixPreconditioner< T >::update().

#define REGPARM (   n,
  x 
)    x

Definition at line 465 of file basics.h.

#define REGPARMA (   n)

Definition at line 464 of file basics.h.

#define RESTRICT

Definition at line 89 of file basics.h.

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

#define RET (   x)

Definition at line 674 of file basics.h.

#define SIGNATURE   class

Definition at line 80 of file basics.h.

#define SQRT (   T)
Value:
TBCI_CONST(inline double sqrt (const T a)) \
{ return MATH__ sqrt ((double)a); }
double sqrt(const int a)
Definition: basics.h:1216
#define TBCI_CONST(x)
Definition: basics.h:458
#define T
Definition: bdmatlib.cc:20
const unsigned TMatrix< T > const Matrix< T > * a
#define MATH__
Definition: basics.h:339

Definition at line 1204 of file basics.h.

#define STD__   std::
#define STRINGSTREAM   strstream

Definition at line 206 of file basics.h.

#define TALIGN (   x)

Definition at line 450 of file basics.h.

#define TBCI__   TBCI::
#define TBCI_CONST (   x)    x

Definition at line 458 of file basics.h.

#define TBCI_DLLEXPORT

Definition at line 124 of file basics.h.

#define TBCI_DLLLOCAL

Definition at line 125 of file basics.h.

#define TBCICLEAR (   n,
  t,
 
)    _par_fill < t > (s,n,t(0))
#define TBCICOMP (   n,
  o,
  t,
 
)    _par_comp< t > (s, n, o)

The above discussion similarily holds for comparing things. memcmp() however is much less dangerous. You risk to have two logically identical objects, which still don't have the same bytes to be compared to be unequal. OTOH, our manual memcmp seems to be faster ...

Definition at line 979 of file basics.h.

Referenced by BVector< T >::operator==(), F_TMatrix< T >::operator==(), BdMatrix< T >::operator==(), TMatrix< T >::operator==(), F_TSMatrix< T >::operator==(), TSVector< T >::operator==(), TSMatrix< T >::operator==(), F_Matrix< T >::operator==(), Vector< T >::operator==(), and Matrix< T >::operator==().

#define TBCICOPY (   n,
  o,
  t,
 
)    _par_copy < t > (s,n,o)

Note (KG, 01/06/15): Discussing with Jan I just got the idea that copying of data with memcpy () is a dangerous thing to do. It only works, if the memory of the type T is contiguous (this is believed to be true) and does not have any pointers with dynamically allocated memory. Again, we have a speed vs. general implementation issue. memcpy () is believed to be faster, normally ... Actually, even the assignment can go wrong, if we have a slightly non-std meaning of assignment like the non-resizing of Vectors and Matrices.

Definition at line 894 of file basics.h.

Referenced by BVector< T >::append(), BVector< T >::BVector(), bvfillm(), F_TSMatrix< T >::clone(), TSVector< T >::clone(), TSMatrix< T >::clone(), BVector< T >::concat(), BdMatrix< T >::do_copy(), F_TMatrix< T >::F_TMatrix(), TMatrix< T >::fill(), F_TMatrix< T >::get_col(), TMatrix< T >::get_row(), Matrix< T >::operator()(), F_TMatrix< T >::operator=(), BVector< T >::operator=(), TMatrix< T >::operator=(), BdMatrix< T >::reconfig(), BVector< T >::remove(), BVector< T >::resize(), F_TMatrix< T >::resize(), BdMatrix< T >::resize(), TMatrix< T >::resize(), F_TMatrix< T >::set_col(), TMatrix< T >::set_row(), TMatrix< T >::set_row_partial(), Vector< T >::slice(), TMatrix< T >::TMatrix(), and Vector< T >::Vector().

#define TBCIERRH1   __PRETTY_FUNCTION__

Definition at line 520 of file basics.h.

#define TBCIERRM (   cond,
  exc,
  txt,
  ind 
)
Value:
STD__ string(#exc) + " in " + TBCIERRH1 + ":\n " + #txt + " at "\
+ __FILE__ + ":" + TBCI__ ltoa(__LINE__) + ":\n (" + #cond \
+ ") == TRUE! (" + #ind + " = " + TBCI__ ltoa(ind) + ")"
#define TBCIERRH1
Definition: basics.h:520
#define TBCI__
Definition: basics.h:332
static char * ltoa(const long l)
Definition: except.h:102
#define STD__
Definition: basics.h:338

Definition at line 521 of file basics.h.

#define TBCIERRS (   cond,
  exc,
  txt,
  ind 
)
Value:
#exc << " in " << TBCIERRH1 << ":\n " << #txt << " at " \
<< __FILE__ << ":" << __LINE__ << ":\n (" << #cond \
<< ") == TRUE! (" << #ind << " = " << ind << ")"

Definition at line 525 of file basics.h.

#define TBCIFILL (   n,
  v,
  t,
 
)    _par_fill < t > (s,n,v)
#define THREAD__

Definition at line 774 of file basics.h.

#define thrno   (0)

Definition at line 783 of file basics.h.

#define TWEAK (   x)    x

Definition at line 486 of file basics.h.

#define UNLIKELY (   expr)    (expr)
#define UNUSED

Definition at line 471 of file basics.h.

#define USE_NS

Definition at line 70 of file basics.h.

#define USING_END   using namespace std; /* Don't use! */

Definition at line 330 of file basics.h.

#define USING_FD   using namespace Finite_Difference;

Definition at line 329 of file basics.h.

#define USING_GRID   using namespace Grid;

Definition at line 328 of file basics.h.

#define USING_STD   using namespace std;

Definition at line 331 of file basics.h.

#define USING_TBCI   using namespace TBCI;

Definition at line 327 of file basics.h.

#define VEC_INLINE   inline

Definition at line 1266 of file basics.h.

#define VEC_INLINE   /*inline*/

Definition at line 1266 of file basics.h.

#define VEC_INLINE   /*inline*/

Definition at line 1266 of file basics.h.

#define VEC_INLINE

Definition at line 1266 of file basics.h.

#define WEAK (   x )    x

Definition at line 485 of file basics.h.

#define WEAKA

Definition at line 484 of file basics.h.