|
TBCI Numerical high perf. C++ Library
2.8.0
|
The TBCI Numerical Library is put into TBCI namespace, if the compiler supports it (egcs-1.1.x and later for example) More...
Classes | |
| class | vec_fill_fn |
Typedefs | |
| typedef enum _vararg | vararg |
Enumerations | |
| enum | _vararg { vag0 =0, vag1, vag2, vag3, vag4, vag5, vag6, vag7, vag8, vag9, vag10, vag11, vag12, vag13, vag14, vag15, vag16, vag_max = 4294967295U } |
| This is a helper type to identify and count varargs. More... | |
Functions | |
| template<typename T > | |
| void | 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_copy (const unsigned long sz, T *const res, const T *const v1) |
| template<typename T > | |
| void | _par_copy (const unsigned long sz, T *v1, const T *v2) |
| template<typename T > | |
| void | _tbci_fill (const unsigned long sz, T *const res, register typename tbci_traits< T >::loop_const_refval_type f2) |
| template<typename T > | |
| void | _par_fill (const unsigned long, T *const, typename tbci_traits< T >::loop_const_refval_type) |
| template<typename T > | |
| void | _tbci_fill_fn (const unsigned long sz, T *vec, vec_fill_fn< T > fn, void *par) |
| template<typename T > | |
| void | 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 | _par_comp (const unsigned long sz, const T *v1, const T *v2) |
| template<typename T > | |
| unsigned long | _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 | 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 > | |
| int | sign (const T &x) |
| Signum. More... | |
| double | fabssqr (const double a) |
| double | fabssqr (const float a) |
| double | fabssqr (const int a) |
| double | fabssqr (const unsigned a) |
| template<typename T > | |
| T | sqr (const T &a) |
| template<typename T > | |
| T | dot (const T &a1, const T &a2) |
The TBCI Numerical Library is put into TBCI namespace, if the compiler supports it (egcs-1.1.x and later for example)
| typedef enum _vararg TBCI::vararg |
| enum TBCI::_vararg |
| 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.
Bound checking (el in range) needs to be done before calling this, also need to make sure that the last element does not match.
Definition at line 992 of file basics.h.
Referenced by CSCMatrix< T >::get().
| void TBCI::_par_fill | ( | const unsigned | long, |
| T * | const, | ||
| typename tbci_traits< T >::loop_const_refval_type | |||
| ) |
|
inline |
Definition at line 891 of file basics.h.
Referenced by HOTDECL(), and job_vv_copy().
| void TBCI::_tbci_fill_fn | ( | const unsigned long | sz, |
| T * | vec, | ||
| vec_fill_fn< T > | fn, | ||
| void * | par | ||
| ) |
Definition at line 928 of file basics.h.
References TBCI::vec_fill_fn< T >::fn, i, and REGISTER.
| 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
Definition at line 975 of file basics.h.
Referenced by job_vv_comp().
Definition at line 1183 of file basics.h.
References std::conj(), and CPLX__.
Referenced by BiCGSTAB(), CG(), CGS(), dot(), and FS_Vector< dims, T >::fabssqr().
|
inline |
Speaking of abs(), fabs() and fabssqr() : abs (T) returns type T, fabs() returns double and fabssqr() also a double (the sqr of fabs)
We want to be able to write templated code that can accept both std:: and TBCI:: types. Now, if such a routine uses functions like fabs() or abs(), we are in trouble: What namespace should the template author use for those? std:: or TBCI:: ?
Options are: (1) importing the pre-existing functions from std:: into TBCI:: (2) export the TBCI::functions to namespace std::
The answer may be different for each of those three types, as fabssqr() does not exist at all in std::, fabs() does exist, but only for doubles and abs() does exist for a number of builtin types as well as (std::complex)
In any case, the functions need to be completed, as no fabs() exists for non-double types, e.g. Additional complication is added by the fact that the whole thing should still work if compiled with NO_NS.
Solution (2) is the prefered one, as it does make users less dependent on TBCI. Unfortunately, this means that we may break backwards compatibility (on source level).
Note that the self-invented functions conj(), real(), imag() and fabssqr() remain in namespace TBCI. The same holds for sqr() and dot().
Definition at line 1157 of file basics.h.
Referenced by FS_Vector< dims, T >::abs(), BiCGSTAB(), fabs(), FS_Vector< dims, T >::fabs(), F_TSMatrix< T >::fabs(), F_Matrix< T >::fabs(), TSMatrix< T >::fabssqr(), operator/(), and QMR().
|
inline |
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.
Unlikely that it's worth it.
Definition at line 813 of file basics.h.
References a, ALIGN, b, MIN_ALIGN, REGISTER, and T.
Referenced by tbci_memalloc_cache< T >::_init(), gaussj(), F_TMatrix< T >::herm(), BVector< T >::swap(), F_BandMatrix< T >::swap(), CRMatrix< T >::swap(), CSCMatrix< T >::swap(), F_TMatrix< T >::swap(), TMatrix< T >::swap(), F_TMatrix< T >::trans(), CTensor< T >::transpose(), F_TMatrix< T >::transpose(), and TMatrix< T >::transpose().
1.8.5