TBCI Numerical high perf. C++ Library 2.8.0
plain_def.h File Reference

macros for composing plain loops over arrays. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LCTYPE(T)
 Shortcut for loop const ref type.
#define LCTYPED(T)
#define VKERN_TEMPL_3V(FNAME, OP3)
 We leave unrolling and prefetching to the compiler.
#define VKERN_TEMPL_3V_C(FNAME, OP3)
 Operations of type vec = vec OP val * vec.
#define VKERN_TEMPL_3V_CC(FNAME, OP3)
 Operations of type vec = val * vec OP val * vec.
#define VKERN_TEMPL_2V(FNAME, OP2)
 Operations of type vec OP= vec.
#define VKERN_TEMPL_2V_C(FNAME, OP2)
 Operations of type VEC = VEC OP VAL or VAL OP VEC.
#define VKERN_TEMPL_2V_CC(FNAME, OP2)
 Operations of type VEC = VEC OP VAL or VAL OP VEC.
#define VKERN_TEMPL_2V_T(FNAME, OP2, TYPE)
 Operations of type TYPE = VEC OP VEC.
#define VKERN_TEMPL_2V_T_STRIDE(FNAME, OP2, TYPE)
 Operations of type TYPE = VEC OP VEC.
#define VKERN_TEMPL_1V(FNAME, OP1)
 Operations of type VEC = OP self.
#define VKERN_TEMPL_1V_C(FNAME, OP1)
 Operations of type VEC OP= VAL.
#define VKERN_TEMPL_1V_CC(FNAME, OP1)
 Operations of type VEC *= S OP= VAL.
#define VKERN_TEMPL_1V_T(FNAME, OP1, TYPE)
 Operations of type TYPE = OP VEC.
#define VKERN_TEMPL_1V_T_LD(FNAME, OP1, TYPE)
 Operations of type TYPE = OP VEC (using LONG_DOUBLE internally).

Detailed Description

macros for composing plain loops over arrays.

(c) Kurt Garloff, kurt@.nosp@m.garl.nosp@m.off.d.nosp@m.e, 7/2002, GNU LGPL v2

Id
plain_def.h,v 1.1.2.17 2022/11/03 17:28:11 garloff Exp

Definition in file plain_def.h.

Macro Definition Documentation

◆ LCTYPE

#define LCTYPE ( T)
Value:
REGISTER typename tbci_traits<T>::loop_const_refval_type
#define REGISTER
Definition basics.h:108

Shortcut for loop const ref type.

Definition at line 13 of file plain_def.h.

◆ LCTYPED

#define LCTYPED ( T)
Value:
REGISTER tbci_traits<T>::loop_const_refval_type

Definition at line 14 of file plain_def.h.

◆ VKERN_TEMPL_1V

#define VKERN_TEMPL_1V ( FNAME,
OP1 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const);) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res) \
{ \
REGISTER unsigned long i; \
OMP_FOR for (i = 0; i < sz; ++i) \
OP1(res[i], f1, f2); \
}
int i
Definition LM_fit.h:71
#define INST(x)
Definition basics.h:238
#define RESTRICT
Definition basics.h:89
#define OMP_FOR
Definition basics.h:708
#define VEC_INLINE
Definition basics.h:889
#define T
Definition bdmatlib.cc:20
const unsigned TMatrix< T > * res

Operations of type VEC = OP self.

Definition at line 159 of file plain_def.h.

◆ VKERN_TEMPL_1V_C

#define VKERN_TEMPL_1V_C ( FNAME,
OP1 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const, LCTYPED(T));) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res, \
LCTYPE(T) f2) \
{ \
REGISTER unsigned long i; \
for (i = 0; i < sz; ++i) \
OP1(res[i], f1, f2); \
}
#define LCTYPED(T)
Definition plain_def.h:14
#define LCTYPE(T)
Shortcut for loop const ref type.
Definition plain_def.h:13

Operations of type VEC OP= VAL.

Definition at line 172 of file plain_def.h.

◆ VKERN_TEMPL_1V_CC

#define VKERN_TEMPL_1V_CC ( FNAME,
OP1 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const, \
LCTYPED(T), LCTYPED(T));) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res, \
LCTYPE(T) f1, \
LCTYPE(T) f2) \
{ \
REGISTER unsigned long i; \
OMP_FOR for (i = 0; i < sz; ++i) \
OP1(res[i], f1, f2); \
}

Operations of type VEC *= S OP= VAL.

Definition at line 186 of file plain_def.h.

◆ VKERN_TEMPL_1V_T

#define VKERN_TEMPL_1V_T ( FNAME,
OP1,
TYPE )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, const T*, TYPE&);) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
const T* res, \
TYPE &_f2) \
{ \
/* REGISTER typename tbci_traits<TYPE>::loop_refval_type f2(_f2); */ \
REGISTER TYPE f2(_f2), f1(0.0); \
REGISTER unsigned long i; \
OMP_FOR_REDUCE_F1F2 for (i = 0; i < sz; ++i) \
OP1(res[i], f1, f2); \
_f2 = f2 - f1; \
}
#define OMP_FOR_REDUCE_F1F2
Definition basics.h:710

Operations of type TYPE = OP VEC.

Definition at line 202 of file plain_def.h.

◆ VKERN_TEMPL_1V_T_LD

#define VKERN_TEMPL_1V_T_LD ( FNAME,
OP1,
TYPE )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, const T*, TYPE&);) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
const T* res, \
TYPE &_f2) \
{ \
/* REGISTER typename tbci_traits<TYPE>::loop_refval_type f2(_f2); */ \
REGISTER LONG_DOUBLE f2(_f2); \
REGISTER unsigned long i; \
OMP_FOR_REDUCE_F2 for (i = 0; i < sz; ++i) \
OP1(res[i], f1, f2); \
_f2 = f2; \
}
#define LONG_DOUBLE
Definition basics.h:219
#define OMP_FOR_REDUCE_F2
Definition basics.h:709

Operations of type TYPE = OP VEC (using LONG_DOUBLE internally).

Definition at line 219 of file plain_def.h.

◆ VKERN_TEMPL_2V

#define VKERN_TEMPL_2V ( FNAME,
OP2 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const, const T* RESTRICT const);) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res, \
const T* RESTRICT const v1) \
{ \
REGISTER unsigned long i; \
OMP_FOR for (i = 0; i < sz; ++i) \
OP2(res[i], v1[i], f1, f2); \
}

Operations of type vec OP= vec.

Definition at line 72 of file plain_def.h.

◆ VKERN_TEMPL_2V_C

#define VKERN_TEMPL_2V_C ( FNAME,
OP2 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
LCTYPED(T));) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res, \
const T* RESTRICT const v1, \
LCTYPE(T) f2) \
{ \
REGISTER unsigned long i; \
OMP_FOR for (i = 0; i < sz; ++i) \
OP2(res[i], v1[i], f1, f2); \
}

Operations of type VEC = VEC OP VAL or VAL OP VEC.

Definition at line 86 of file plain_def.h.

◆ VKERN_TEMPL_2V_CC

#define VKERN_TEMPL_2V_CC ( FNAME,
OP2 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
LCTYPED(T), LCTYPED(T));) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res, \
const T* RESTRICT const v1, \
LCTYPE(T) f1, \
LCTYPE(T) f2) \
{ \
REGISTER unsigned long i; \
OMP_FOR for (i = 0; i < sz; ++i) \
OP2(res[i], v1[i], f1, f2); \
}

Operations of type VEC = VEC OP VAL or VAL OP VEC.

Definition at line 102 of file plain_def.h.

◆ VKERN_TEMPL_2V_T

#define VKERN_TEMPL_2V_T ( FNAME,
OP2,
TYPE )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, const T* RESTRICT const, \
const T* RESTRICT const, TYPE&);) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
const T* RESTRICT const v1, \
const T* RESTRICT const v2, \
TYPE &_f2) \
{ \
/* REGISTER typename tbci_traits<TYPE>::loop_refval_type f2(_f2); */ \
REGISTER TYPE f2(_f2), f1(0.0); \
REGISTER unsigned long i; \
OMP_FOR_REDUCE_F1F2 for (i = 0; i < sz; ++i) \
OP2(v1[i], v2[i], f1, f2); \
_fin: \
_f2 = f2 - f1; \
}

Operations of type TYPE = VEC OP VEC.

Definition at line 119 of file plain_def.h.

◆ VKERN_TEMPL_2V_T_STRIDE

#define VKERN_TEMPL_2V_T_STRIDE ( FNAME,
OP2,
TYPE )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, const T* RESTRICT const, \
const T* RESTRICT const, TYPE&, const unsigned);) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
const T* RESTRICT const v1, \
const T* RESTRICT const v2, \
TYPE &_f2, const unsigned rincr) \
{ \
/* REGISTER typename tbci_traits<TYPE>::loop_refval_type f2(_f2); */ \
REGISTER TYPE f2(_f2), f1(0.0); \
REGISTER unsigned long i; \
OMP_FOR_REDUCE_F1F2 for (i = 0; i < sz; ++i) \
OP2(v1[i*rincr], v2[i], f1, f2); \
_fin: \
_f2 = f2 - f1; \
}

Operations of type TYPE = VEC OP VEC.

Definition at line 139 of file plain_def.h.

◆ VKERN_TEMPL_3V

#define VKERN_TEMPL_3V ( FNAME,
OP3 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
const T* RESTRICT const);) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res, \
const T* RESTRICT const v1, \
const T* RESTRICT const v2) \
{ \
REGISTER unsigned long i; \
OMP_FOR for (i = 0; i < sz; ++i) \
OP3(res[i], v1[i], v2[i], f1, f2); \
}

We leave unrolling and prefetching to the compiler.

Operations of type vec = vec OP vec

Definition at line 21 of file plain_def.h.

◆ VKERN_TEMPL_3V_C

#define VKERN_TEMPL_3V_C ( FNAME,
OP3 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
const T* RESTRICT const, LCTYPED(T));) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res, \
const T* RESTRICT const v1, \
const T* RESTRICT const v2, \
LCTYPE(T) f2) \
{ \
REGISTER unsigned long i; \
OMP_FOR for (i = 0; i < sz; ++i) \
OP3(res[i], v1[i], v2[i], f1, f2); \
}

Operations of type vec = vec OP val * vec.

Definition at line 37 of file plain_def.h.

◆ VKERN_TEMPL_3V_CC

#define VKERN_TEMPL_3V_CC ( FNAME,
OP3 )
Value:
INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
(const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
const T* RESTRICT const, LCTYPED(T), LCTYPED(T));) \
template <typename T> \
VEC_INLINE void FNAME (const unsigned long sz, \
T* RESTRICT const res, \
const T* RESTRICT const v1, \
const T* RESTRICT const v2, \
LCTYPE(T) f1, \
LCTYPE(T) f2) \
{ \
REGISTER unsigned long i; \
OMP_FOR for (i = 0; i < sz; ++i) \
OP3(res[i], v1[i], v2[i], f1, f2); \
}

Operations of type vec = val * vec OP val * vec.

Definition at line 54 of file plain_def.h.