convolve.h File Reference

Classes

Namespaces

Defines

Functions


Detailed Description

Convolution kernels for MArrays implementing various smoothing kernels and finite differences methods that can be used in any MArray expression. Currently, convoltions are implemented for expressions of up to rank 3.


Define Documentation

#define OFFSET0 (  )     (*A)

access the element at the current position (offset 0)

#define OFFSET ( A,
i,
dim   )     (A.readAtOffsetDim(i,dim))

access the element at offset i in the dimension dim

Referenced by ltl::grad3D::eval(), and ltl::grad2D::eval().

#define OFFSET1 ( A,
 )     (A.readAtOffset(i))

access the element at offset i in the first dimension (the one with the smallest stride).

#define OFFSET2 ( A,
i,
 )     (A.readAtOffset(i,j))

access the element at offset i in the first, and j in the second dimension.

#define OFFSET3 ( A,
i,
j,
 )     (A.readAtOffset(i,j,k))

access the element at offset i in the first, j in the second, and k in the third dimension.

#define DECLARE_CONVOLUTION_OPERATOR ( name,
 ) 
Value:
struct name                                                  \
{                                                            \
      template<typename Iter>                                \
      static inline typename Iter::value_type eval(Iter& A)  \
      {

declare and implement a convolution kernel that needs no parameters. The macro argument name will be used to call the kernel using convolve(Expr, kernel()). The parameter A is used in the implementation to refer to the expression to convolve at runtime.

It is assumed that the convolution operation yields the same data type as the operand of the convolution.

  DECLARE_CONVOLUTION_OPERATOR(mykernel,A)
      return OFFSET1(A,1) - OFFSET1(A,-1) ... ;
  END_CONVOLUTION_OPERATOR;
#define DECLARE_CONVOLUTION_OPERATOR_DIM ( name,
 ) 
Value:
struct name                                                  \
{                                                            \
      name( const int d ) : dim(d) {}                        \
      const int dim;                                         \
      template<typename Iter>                                \
      inline typename Iter::value_type eval(Iter& A) const   \
      {

declare and implement a convolution kernel that takes one integer argument. The macro argument name will be used to call the kernel using convolve(Expr, kernel(int)). The parameter A is used in the implementation to refer to the expression to convolve at runtime. The int that is passed in the constructor may be used inside the evaluation function. It is meant to specify a dimension, such as in the cderiv(int dim) kernels (derivatives along dimension dim).

It is assumed that the convolution operation yields the same data type as the operand of the convolution.

  // first derivative using central differences along
  // dimension dim:
  DECLARE_CONVOLUTION_OPERATOR_DIM(cderiv1,A)
      return OFFSET(A,1,dim) - OFFSET(A,-1,dim);
  END_CONVOLUTION_OPERATOR;

Generated on 19 Feb 2015 for LTL by  doxygen 1.6.1