TMB Documentation  v1.9.11
Macros
Vectorize.hpp File Reference

Macros to do vectorization. More...

Go to the source code of this file.

Macros

#define GVECTORIZE(FUN, Type1, Type2, Type3, Type4, Type5, Type6)
 General vectorize macro up to 6 arguments. More...
 
#define VECTORIZE1_n(FUN)
 Add the 'n' integer argument to a simulation method with one argument.
 
#define VECTORIZE1_t(FUN)   GVECTORIZE(FUN,V,N,N,N,N,N)
 Vectorize 1-argument functions.
 
#define VECTORIZE2_n(FUN)
 Add the 'n' integer argument to a simulation method with two arguments.
 
#define VECTORIZE2_tt(FUN)
 Vectorize 2-argument functions. More...
 
#define VECTORIZE3_n(FUN)
 Add the 'n' integer argument to a simulation method with three arguments.
 
#define VECTORIZE3_tti(FUN)
 Vectorize 3-argument functions. More...
 
#define VECTORIZE3_ttt(FUN)
 Vectorize 3-argument functions. More...
 
#define VECTORIZE4_ttti(FUN)
 Vectorize 4-argument functions. More...
 
#define VECTORIZE5_tttti(FUN)
 Vectorize 5-argument functions. More...
 
#define VECTORIZE6_ttttti(FUN)
 Vectorize 6-argument functions. More...
 

Detailed Description

Macros to do vectorization.

Definition in file Vectorize.hpp.

Macro Definition Documentation

§ GVECTORIZE

#define GVECTORIZE (   FUN,
  Type1,
  Type2,
  Type3,
  Type4,
  Type5,
  Type6 
)
Value:
template <class Type> \
vector<Type> FUN( declare##Type1(arg1) comma##Type2 \
declare##Type2(arg2) comma##Type3 \
declare##Type3(arg3) comma##Type4 \
declare##Type4(arg4) comma##Type5 \
declare##Type5(arg5) comma##Type6 \
declare##Type6(arg6) ) \
{ \
int n = 0; \
outputsize##Type1(n,arg1); \
outputsize##Type2(n,arg2); \
outputsize##Type3(n,arg3); \
outputsize##Type4(n,arg4); \
outputsize##Type5(n,arg5); \
outputsize##Type6(n,arg6); \
vector<Type> res(n); \
for(int i=0;i<n;i++) res[i] = FUN( element##Type1(arg1,i) comma##Type2 \
element##Type2(arg2,i) comma##Type3 \
element##Type3(arg3,i) comma##Type4 \
element##Type4(arg4,i) comma##Type5 \
element##Type5(arg5,i) comma##Type6 \
element##Type6(arg6,i) ); \
return res; \
}

General vectorize macro up to 6 arguments.

Applied type abbreviations: V=vector, T=scalar, I=integer, N=none. The longest vector input determines the length of the output. Arguments are not re-cycled; unequal vector lengths should result in a crash.

Definition at line 36 of file Vectorize.hpp.

§ VECTORIZE2_tt

#define VECTORIZE2_tt (   FUN)
Value:
GVECTORIZE(FUN,V,T,N,N,N,N) \
GVECTORIZE(FUN,T,V,N,N,N,N) \
GVECTORIZE(FUN,V,V,N,N,N,N)
#define GVECTORIZE(FUN, Type1, Type2, Type3, Type4, Type5, Type6)
General vectorize macro up to 6 arguments.
Definition: Vectorize.hpp:36

Vectorize 2-argument functions.

For two-arguments functions (Type, Type), vectorize both arguments.

Definition at line 71 of file Vectorize.hpp.

Referenced by tmbutils::interpol2D< Type >::operator()().

§ VECTORIZE3_tti

#define VECTORIZE3_tti (   FUN)
Value:
GVECTORIZE(FUN,V,T,I,N,N,N) \
GVECTORIZE(FUN,T,V,I,N,N,N) \
GVECTORIZE(FUN,V,V,I,N,N,N)
#define GVECTORIZE(FUN, Type1, Type2, Type3, Type4, Type5, Type6)
General vectorize macro up to 6 arguments.
Definition: Vectorize.hpp:36

Vectorize 3-argument functions.

For three-arguments functions (Type, Type, int), vectorize first two arguments.

Definition at line 81 of file Vectorize.hpp.

§ VECTORIZE3_ttt

#define VECTORIZE3_ttt (   FUN)
Value:
GVECTORIZE(FUN,V,T,T,N,N,N) \
GVECTORIZE(FUN,T,V,T,N,N,N) \
GVECTORIZE(FUN,T,T,V,N,N,N) \
GVECTORIZE(FUN,V,V,T,N,N,N) \
GVECTORIZE(FUN,T,V,V,N,N,N) \
GVECTORIZE(FUN,V,T,V,N,N,N) \
GVECTORIZE(FUN,V,V,V,N,N,N)
#define GVECTORIZE(FUN, Type1, Type2, Type3, Type4, Type5, Type6)
General vectorize macro up to 6 arguments.
Definition: Vectorize.hpp:36

Vectorize 3-argument functions.

For three-arguments functions (Type, Type, Type), vectorize all three arguments.

Definition at line 91 of file Vectorize.hpp.

§ VECTORIZE4_ttti

#define VECTORIZE4_ttti (   FUN)
Value:
GVECTORIZE(FUN,V,T,T,I,N,N) \
GVECTORIZE(FUN,T,V,T,I,N,N) \
GVECTORIZE(FUN,T,T,V,I,N,N) \
GVECTORIZE(FUN,V,V,T,I,N,N) \
GVECTORIZE(FUN,T,V,V,I,N,N) \
GVECTORIZE(FUN,V,T,V,I,N,N) \
GVECTORIZE(FUN,V,V,V,I,N,N)
#define GVECTORIZE(FUN, Type1, Type2, Type3, Type4, Type5, Type6)
General vectorize macro up to 6 arguments.
Definition: Vectorize.hpp:36

Vectorize 4-argument functions.

For Four-arguments functions (Type, Type, Type, int), vectorize first three arguments.

Definition at line 105 of file Vectorize.hpp.

§ VECTORIZE5_tttti

#define VECTORIZE5_tttti (   FUN)
Value:
GVECTORIZE(FUN,V,T,T,T,I,N) \
GVECTORIZE(FUN,T,V,T,T,I,N) \
GVECTORIZE(FUN,T,T,V,T,I,N) \
GVECTORIZE(FUN,V,V,T,T,I,N) \
GVECTORIZE(FUN,T,V,V,T,I,N) \
GVECTORIZE(FUN,V,T,V,T,I,N) \
GVECTORIZE(FUN,V,V,V,T,I,N)
#define GVECTORIZE(FUN, Type1, Type2, Type3, Type4, Type5, Type6)
General vectorize macro up to 6 arguments.
Definition: Vectorize.hpp:36

Vectorize 5-argument functions.

For Five-arguments functions (Type, Type, Type, Type, int), vectorize first four arguments.

Definition at line 119 of file Vectorize.hpp.

§ VECTORIZE6_ttttti

#define VECTORIZE6_ttttti (   FUN)
Value:
GVECTORIZE(FUN,V,T,T,T,T,I) \
GVECTORIZE(FUN,T,V,T,T,T,I) \
GVECTORIZE(FUN,T,T,V,T,T,I) \
GVECTORIZE(FUN,V,V,T,T,T,I) \
GVECTORIZE(FUN,T,V,V,T,T,I) \
GVECTORIZE(FUN,V,T,V,T,T,I) \
GVECTORIZE(FUN,V,V,V,T,T,I)
#define GVECTORIZE(FUN, Type1, Type2, Type3, Type4, Type5, Type6)
General vectorize macro up to 6 arguments.
Definition: Vectorize.hpp:36

Vectorize 6-argument functions.

For Six-arguments functions (Type, Type, Type, Type, Type, int), vectorize first three arguments.

Definition at line 133 of file Vectorize.hpp.

License: GPL v2