31#ifndef BZ_TMEVALUATE_H
32#define BZ_TMEVALUATE_H
35#include <blitz/update.h>
37#include <blitz/meta/vecassign.h>
44template<
bool unroll,
int N_rows,
int N_columns>
55 template<
typename T,
typename T_expr,
typename T_update>
58 const T_expr& expr, T_update) {
64 if (!expr.shapeCheck(dest.
shape()))
66 if (assertFailMode ==
false)
68 cerr <<
"[Blitz++] Shape check failed: Module " << __FILE__
69 <<
" line " << __LINE__ << endl
73 expr.prettyPrint(str, format);
79 BZPRECHECK(expr.shapeCheck(dest.
shape()),
80 "Shape check failed." << endl <<
"Expression:");
91 template<
typename T_numtype,
typename T_expr,
typename T_update>
94#ifdef BZ_USE_ALIGNMENT_PRAGMAS
98 for (
int i=0; i < N_rows*N_columns; ++i)
99 T_update::update(data[i], expr.fastRead(i));
106 template<
typename T_numtype,
typename T_expr,
typename T_update>
109#ifdef BZ_USE_ALIGNMENT_PRAGMAS
111#pragma vector unaligned
113 for (
int i=0; i < N_rows*N_columns; ++i)
114 T_update::update(data[i], expr.fastRead(i));
119template<
int N_rows,
int N_columns>
125 template<
typename T,
typename T_expr,
typename T_update>
128 const T_expr& expr, T_update) {
129 _bz_evaluate(dest, expr, T_update());
136 template<
typename T_numtype,
typename T_expr,
typename T_update>
139#ifdef BZ_USE_ALIGNMENT_PRAGMAS
143 _bz_meta_vecAssign<N_rows*N_columns, 0>::fastAssign(data, expr, T_update());
150 template<
typename T_numtype,
typename T_expr,
typename T_update>
155 _bz_meta_vecAssign<N_rows*N_columns, 0>::fastAssign(data, expr, T_update());
163template<
typename P_numtype,
int N_rows,
int N_columns>
164template<
typename T_expr,
typename T_update>
169 const bool mixed_expr =
170 (T_expr::numArrayOperands>0) ||
171 (T_expr::numTVOperands>0) ||
172 (T_expr::numIndexPlaceholders>0);
static TinyVector< int, 2 > shape()
Definition tinymat2.h:181
const T_numtype *restrict data() const
Definition tinymat2.h:120
void _tm_evaluate(const T_expr &expr, T_update)
#define true
Definition compiler.h:101
Definition array-impl.h:66
The _tm_evaluator class has a bool template argument that is used to select code paths at compile tim...
Definition tmevaluate.h:45
static _bz_forceinline void select_evaluation(TinyMatrix< T, N_rows, N_columns > &dest, const T_expr &expr, T_update)
The select_evaluation function redirects expressions that do not contains solely TinyMatrix operands ...
Definition tmevaluate.h:57
static _bz_forceinline void evaluate_aligned(T_numtype *data, const T_expr &expr, T_update)
This version of the evaluation function assumes that the TinyMatrixs have appropriate alignment (as w...
Definition tmevaluate.h:93
static _bz_forceinline void evaluate_unaligned(T_numtype *data, const T_expr &expr, T_update)
This version of the evaluation function is used when vectorizing expressions that we know can't be al...
Definition tmevaluate.h:108
static _bz_forceinline void select_evaluation(TinyMatrix< T, N_rows, N_columns > &dest, const T_expr &expr, T_update)
The false version of select_evaluation is picked for expressions that contain operands other than Tin...
Definition tmevaluate.h:127
static _bz_forceinline void evaluate_aligned(T_numtype *data, const T_expr &expr, T_update)
This version of the evaluation function assumes that the TinyMatrixs have appropriate alignment (as w...
Definition tmevaluate.h:138
static _bz_forceinline void evaluate_unaligned(T_numtype *data, const T_expr &expr, T_update)
This version of the evaluation function is used when vectorizing expressions that we know can't be al...
Definition tmevaluate.h:152
#define _bz_forceinline
Definition tuning.h:79
#define BZ_TV_EVALUATE_UNROLL_LENGTH
Definition tuning.h:64