LTL  2.0.x
Public Types | Public Member Functions | List of all members
ltl::ExprNode< A, N > Class Template Reference

Node in the expression parse tree. Every expression in ultimately represented by this class. More...

Inherits ltl::ExprBase< ExprNode< A, N >, N >, and ltl::LTLIterator.

Public Types

typedef A::value_type value_type
 the result data type of the parse tree node More...
 
enum  
 
enum  { dims =N }
 The number of dimensions. More...
 
enum  { numIndexIter = A::numIndexIter }
 The number of ltl::IndexIter index iterators in all the parse tree below this node. More...
 
enum  { numConvolution = A::numConvolution }
 The number of convolution operations in the parse tree below this node. More...
 
enum  { isVectorizable = A::isVectorizable }
 Is the whole parse tree below this node vectorizable. More...
 

Public Member Functions

 ExprNode (const A &a)
 Constructor. More...
 
void operator++ ()
 Move all iterators in the parse tree below us forward. Slowest, but works for all expressions. More...
 
value_type operator* () const
 compute and return the value of the subexpression in the parse tree below us. More...
 
ExprNode< A, N > & derived ()
 
const ExprNode< A, N > & derived () const
 
void advance ()
 
void advance (const int i)
 
void advance (const int i, const int dim)
 
void advanceWithStride1 ()
 
void advanceDim ()
 
void advanceDim (const int cutDim)
 
value_type readWithoutStride (const int i) const
 
value_type readWithStride (const int i) const
 
value_type readWithStride (const int i, const int dim) const
 
value_type readAtOffsetDim (const int i, const int dim) const
 
value_type readAtOffset (const int i) const
 
value_type readAtOffset (const int i, const int j) const
 
value_type readAtOffset (const int i, const int j, const int k) const
 
int boundary_l (const int dim) const
 
int boundary_u (const int dim) const
 
bool isStorageContiguous () const
 Storage geometry. More...
 
bool isStride1 () const
 true if the innermost stride is unity More...
 
bool isConformable (const Shape< N > &other) const
 true if we are conformable with another shape More...
 
void reset ()
 Reset the iterators in the parse tree below us. More...
 
const Shape< N > * shape () const
 Return one of the shape objects from the parse tree. More...
 
ExprIter< A, N > begin ()
 Return an ExprIter. More...
 
ExprIter< A, N > end ()
 Return an end ExprIter. More...
 

Detailed Description

template<typename A, int N>
class ltl::ExprNode< A, N >

Node in the expression parse tree. Every expression in ultimately represented by this class.

This class represents a node in the parse tree of an expression. Any operation or operand is captured as a type ExprNode<Op,N>, where Op represents the operation or operand and N the number of dimensions. This way, there is a single data type ExprNode<> associated with any parse tree element.

The operation or operand Op are of the types ExprLiteralNode ExprBinopNode ExprUnopNode MArrayIter MergeExpr ApplyExpr ApplyExprBin ConvolveExpr

Like all parse tree elements, this class implements the iterator interface. It forwards all iterator calls to the operation or operand it wraps.

Member Typedef Documentation

template<typename A, int N>
typedef A::value_type ltl::ExprNode< A, N >::value_type

the result data type of the parse tree node

Member Enumeration Documentation

template<typename A, int N>
anonymous enum

The number of dimensions.

Enumerator
dims 
template<typename A, int N>
anonymous enum

The number of ltl::IndexIter index iterators in all the parse tree below this node.

Enumerator
numIndexIter 
template<typename A, int N>
anonymous enum

The number of convolution operations in the parse tree below this node.

Enumerator
numConvolution 
template<typename A, int N>
anonymous enum

Is the whole parse tree below this node vectorizable.

Enumerator
isVectorizable 
anonymous enum
inherited

Constructor & Destructor Documentation

template<typename A, int N>
ltl::ExprNode< A, N >::ExprNode ( const A &  a)
inline

Constructor.

Member Function Documentation

template<typename A, int N>
void ltl::ExprNode< A, N >::operator++ ( )
inline

Move all iterators in the parse tree below us forward. Slowest, but works for all expressions.

template<typename A, int N>
value_type ltl::ExprNode< A, N >::operator* ( ) const
inline

compute and return the value of the subexpression in the parse tree below us.

template<typename A, int N>
void ltl::ExprNode< A, N >::advance ( )
inline

Move all iterators in the parse tree below us forward. Used in unrolling/combining the expression evaluation loops when possible.

template<typename A, int N>
void ltl::ExprNode< A, N >::advance ( const int  i)
inline
template<typename A, int N>
void ltl::ExprNode< A, N >::advance ( const int  i,
const int  dim 
)
inline
template<typename A, int N>
void ltl::ExprNode< A, N >::advanceWithStride1 ( )
inline
template<typename A, int N>
void ltl::ExprNode< A, N >::advanceDim ( )
inline
template<typename A, int N>
void ltl::ExprNode< A, N >::advanceDim ( const int  cutDim)
inline
template<typename A, int N>
value_type ltl::ExprNode< A, N >::readWithoutStride ( const int  i) const
inline

Compute and return the value of the subexpression in the parse tree below us. Used in unrolling/combining the expression evaluation loops when possible.

template<typename A, int N>
value_type ltl::ExprNode< A, N >::readWithStride ( const int  i) const
inline
template<typename A, int N>
value_type ltl::ExprNode< A, N >::readWithStride ( const int  i,
const int  dim 
) const
inline
template<typename A, int N>
value_type ltl::ExprNode< A, N >::readAtOffsetDim ( const int  i,
const int  dim 
) const
inline

Compute and return the value of the subexpression in the parse tree below us at an offset in dimension 1, 2, and/or 3. Used for evaluating convolutions

template<typename A, int N>
value_type ltl::ExprNode< A, N >::readAtOffset ( const int  i) const
inline
template<typename A, int N>
value_type ltl::ExprNode< A, N >::readAtOffset ( const int  i,
const int  j 
) const
inline
template<typename A, int N>
value_type ltl::ExprNode< A, N >::readAtOffset ( const int  i,
const int  j,
const int  k 
) const
inline
template<typename A, int N>
int ltl::ExprNode< A, N >::boundary_l ( const int  dim) const
inline

Return the width of the lower/upper boundary in dimension dim to be left unevaluated. Zero in most cases except for convolutions, which do require padding of the half-width of the kernel.

template<typename A, int N>
int ltl::ExprNode< A, N >::boundary_u ( const int  dim) const
inline
template<typename A, int N>
bool ltl::ExprNode< A, N >::isStorageContiguous ( void  ) const
inline

Storage geometry.

template<typename A, int N>
bool ltl::ExprNode< A, N >::isStride1 ( ) const
inline

true if the innermost stride is unity

template<typename A, int N>
bool ltl::ExprNode< A, N >::isConformable ( const Shape< N > &  other) const
inline

true if we are conformable with another shape

template<typename A, int N>
void ltl::ExprNode< A, N >::reset ( )
inline

Reset the iterators in the parse tree below us.

Referenced by ltl::kappa_sigma_average(), and ltl::variance().

template<typename A, int N>
const Shape<N>* ltl::ExprNode< A, N >::shape ( ) const
inline

Return one of the shape objects from the parse tree.

Referenced by ltl::kappa_sigma_average().

template<typename A, int N>
ExprIter<A,N> ltl::ExprNode< A, N >::begin ( )
inline

Return an ExprIter.

Referenced by ltl::MArray< T, N >::operator<<().

template<typename A, int N>
ExprIter<A,N> ltl::ExprNode< A, N >::end ( )
inline

Return an end ExprIter.

ExprNode< A, N > & ltl::ExprBase< ExprNode< A, N > , N_Dims >::derived ( )
inlineinherited
const ExprNode< A, N > & ltl::ExprBase< ExprNode< A, N > , N_Dims >::derived ( ) const
inlineinherited