LTL  2.0.x
Classes | Namespaces | Macros | Functions
expr.h File Reference

This file defines expression template parse tree nodes and macors for creating global unary and binary operators/functions. More...

Classes

class  ltl::ExprNode< A, N >
 Node in the expression parse tree. Every expression in ultimately represented by this class. More...
 
class  ltl::ExprBinopNode< A, B, Op, N >
 Binary operation node in the expression parse tree. More...
 
class  ltl::ExprUnopNode< A, Op, N >
 Unary operation node in the expression parse tree. More...
 
class  ltl::ExprLiteralNode< T >
 Node in the expression parse tree representing a literal number. More...
 

Namespaces

 ltl
 

Macros

#define BINOP_AA(operator, op)
 Define the global binary functions/operators for ltl::MArray expressions, version for 2 MArray operands, overloaded versions below. More...
 
#define BINOP_AE(operator, op)
 
#define BINOP_EA(operator, op)
 
#define BINOP_AL(operator, op)
 
#define BINOP_LA(operator, op)
 
#define BINOP_EE(operator, op)
 
#define BINOP_EL(operator, op)
 
#define BINOP_LE(operator, op)
 
#define UNOP_E(operator, op)
 Define the global unary operators, overloaded versions for marray operand. More...
 
#define DECLARE_UNOP(operation, opname)
 Make a unary (built-in) operator available to expression templates.This macro declares all necessary overloaded operators to build the parse tree for a given unary operator operation. The return type is the standard C type-promoted result of the operation on built in scalar types. More...
 
#define DECLARE_UNARY_FUNC_(function)
 Make any unary function available to expression templates.This macro declares all necessary overloaded operators to build the parse tree for a given unary function function. The return type may be different than the operand type. More...
 
#define DECLARE_BINARY_FUNC(function, ret_type)
 Make any user-defined binary function available to expression templates.This macro declares all necessary overloaded operators to build the parse tree for a given binary function function. The return type may be different than the operand type. More...
 
#define DECLARE_UNARY_FUNC(function, ret_type)
 Make any user-defined unary function available to expression templates.This macro declares all necessary overloaded operators to build the parse tree for a given unary function function. The return type may be different than the operand type. More...
 
#define DECLARE_BINOP(operation, opname)
 Make a binary (built-in) operator available to expression templates.This macro declares all necessary overloaded operators to build the parse tree for a given binary operator operation. The return type is the standard C type-promoted result of the operation on built in scalar types. More...
 
#define DECLARE_BINARY_FUNC_(function)
 Make any binary function available to expression templates.This macro declares all necessary overloaded operators to build the parse tree for a given binary function function. The return type may be different than the operand type. More...
 

Functions

template<typename A , typename B >
const Shape< A::dims > * ltl::_expr_getshape (const A &a, const B &)
 Determine the shape of an expression by returning the ltl::Shape objects on one of the ltl::MArray operatnds. More...
 
template<typename A , typename T >
const Shape< A::dims > * ltl::_expr_getshape (const A &a, const ExprLiteralNode< T > &)
 
template<typename A , typename T >
const Shape< A::dims > * ltl::_expr_getshape (const ExprLiteralNode< T > &, const A &a)
 
template<typename A , typename B >
int ltl::_expr_getalign (const A &a, const B &)
 Determine the alignment (w.r.t. natural vector boundaries) of the operands in an expression. More...
 
template<typename A , typename T >
int ltl::_expr_getalign (const A &a, const ExprLiteralNode< T > &)
 
template<typename T , typename A >
int ltl::_expr_getalign (const ExprLiteralNode< T > &, const A &a)
 

Detailed Description

This file defines expression template parse tree nodes and macors for creating global unary and binary operators/functions.

Macro Definition Documentation

#define BINOP_AE (   operator,
  op 
)
Value:
template<typename T1, typename T2, int N> \
inline ExprNode<ExprBinopNode<typename MArray<T1,N>::ConstIterator, \
ExprNode<T2,N>, \
op<T1, typename T2::value_type>, \
N>, \
N> \
operator(const MArray<T1,N>& a, const ExprNode<T2,N>& b) \
{ \
typedef ExprBinopNode<typename MArray<T1,N>::ConstIterator, \
ExprNode<T2,N>, \
op<T1, typename T2::value_type>, \
N> \
ExprT; \
return ExprNode<ExprT,N>( ExprT(a.begin(), b) ); \
}
#define BINOP_EA (   operator,
  op 
)
Value:
template<typename T1, typename T2, int N> \
inline ExprNode<ExprBinopNode<ExprNode<T1,N>, \
typename MArray<T2,N>::ConstIterator, \
op<typename T1::value_type, T2>, \
N>, \
N> \
operator(const ExprNode<T1,N>& a, const MArray<T2,N>& b) \
{ \
typedef ExprBinopNode<ExprNode<T1,N>, \
typename MArray<T2,N>::ConstIterator, \
op<typename T1::value_type, T2>, \
N> \
ExprT; \
return ExprNode<ExprT,N>( ExprT(a, b.begin()) ); \
}
#define BINOP_AL (   operator,
  op 
)
Value:
template<typename T1, typename T2, int N> \
inline ExprNode<ExprBinopNode<typename MArray<T1,N>::ConstIterator, \
ExprLiteralNode<T2>, \
op<T1, T2>, \
N>, \
N> \
operator(const MArray<T1,N>& a, const T2& b) \
{ \
typedef ExprBinopNode<typename MArray<T1,N>::ConstIterator, \
ExprLiteralNode<T2>, \
op<T1, T2>, \
N> \
ExprT; \
return ExprNode<ExprT,N>( ExprT(a.begin(), ExprLiteralNode<T2>(b)) ); \
}
#define BINOP_LA (   operator,
  op 
)
Value:
template<typename T1, typename T2, int N> \
inline ExprNode<ExprBinopNode<ExprLiteralNode<T1>, \
typename MArray<T2,N>::ConstIterator, \
op<T1, T2>, \
N>, \
N> \
operator(const T1& a, const MArray<T2,N>& b) \
{ \
typedef ExprBinopNode<ExprLiteralNode<T1>, \
typename MArray<T2,N>::ConstIterator, \
op<T1, T2>, \
N> \
ExprT; \
return ExprNode<ExprT,N>( ExprT(ExprLiteralNode<T1>(a), b.begin()) ); \
}
#define BINOP_EE (   operator,
  op 
)
Value:
template<typename T1, typename T2, int N> \
inline ExprNode<ExprBinopNode<ExprNode<T1,N>, \
ExprNode<T2,N>, \
op<typename T1::value_type, typename T2::value_type>, \
N>, \
N> \
operator(const ExprNode<T1,N>& a, const ExprNode<T2,N>& b) \
{ \
typedef ExprBinopNode<ExprNode<T1,N>, \
ExprNode<T2,N>, \
op<typename T1::value_type, typename T2::value_type>, \
N> \
ExprT; \
return ExprNode<ExprT,N>( ExprT(a, b) ); \
}
#define BINOP_EL (   operator,
  op 
)
Value:
template<typename T1, typename T2, int N> \
inline ExprNode<ExprBinopNode<ExprNode<T1,N>, \
ExprLiteralNode<T2>, \
op<typename T1::value_type, T2>, \
N>, \
N> \
operator(const ExprNode<T1,N>& a, const T2& b) \
{ \
typedef ExprBinopNode<ExprNode<T1,N>, \
ExprLiteralNode<T2>, \
op<typename T1::value_type, T2>, \
N> \
ExprT; \
return ExprNode<ExprT,N>( ExprT(a, ExprLiteralNode<T2>(b)) ); \
}
#define BINOP_LE (   operator,
  op 
)
Value:
template<typename T1, typename T2, int N> \
inline ExprNode<ExprBinopNode<ExprLiteralNode<T1>, \
ExprNode<T2,N>, \
op<T1, typename T2::value_type>, \
N>, \
N> \
operator(const T1& a, const ExprNode<T2,N>& b) \
{ \
typedef ExprBinopNode<ExprLiteralNode<T1>, \
ExprNode<T2,N>, \
op<T1, typename T2::value_type>, \
N> \
ExprT; \
return ExprNode<ExprT,N>( ExprT(ExprLiteralNode<T1>(a), b) ); \
}