DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
Classes | Namespaces | Macros | Functions
utlFunctors.h File Reference
#include "utlCoreMacro.h"
#include "utlCore.h"
#include "utlExpression.h"
#include <cmath>
+ Include dependency graph for utlFunctors.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  utl::Functor::Abs< T >
 
struct  utl::Functor::Abs< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Acos< T >
 
struct  utl::Functor::Acos< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Asin< T >
 
struct  utl::Functor::Asin< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Atan< T >
 
struct  utl::Functor::Atan2< T >
 
struct  utl::Functor::Atan< utl::NDArray< T, Dim > >
 
class  utl::Functor::Compose< TVector, TOutput >
 
struct  utl::Functor::Conj< T >
 
struct  utl::Functor::Conj< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Cos< T >
 
struct  utl::Functor::Cos< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Cube< T >
 
struct  utl::Functor::Cube< utl::NDArray< T, Dim > >
 
class  utl::Functor::DotProduct< TVector, TOutput >
 
struct  utl::Functor::Exp< T >
 
struct  utl::Functor::Exp2< T >
 
struct  utl::Functor::Exp2< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Exp< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Floor< T >
 
struct  utl::Functor::Floor< utl::NDArray< T, Dim > >
 
class  utl::Functor::InfNorm< TVector, TOutput >
 
struct  utl::Functor::Log< T >
 
struct  utl::Functor::Log10< T >
 
struct  utl::Functor::Log10< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Log2< T >
 
struct  utl::Functor::Log2< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Log< utl::NDArray< T, Dim > >
 
struct  utl::Functor::LRound< T >
 
struct  utl::Functor::LRound< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Max< T >
 
class  utl::Functor::MaxValue< TVector, TOutput >
 
class  utl::Functor::Mean< TVector, TOutput >
 
class  utl::Functor::Median< TVector, TOutput >
 
struct  utl::Functor::Min< T >
 
class  utl::Functor::MinValue< TVector, TOutput >
 
class  utl::NDArray< T, Dim >
 
struct  utl::Functor::Neg< T >
 
struct  utl::Functor::Neg< utl::NDArray< T, Dim > >
 
class  utl::Functor::OneNorm< TVector, TOutput >
 
struct  utl::Functor::Pow< T >
 
struct  utl::Functor::Round< T >
 
struct  utl::Functor::Round< utl::NDArray< T, Dim > >
 
class  utl::Functor::ScalarFunctorWrapper< TFunctor, TVector, TOutput >
 
class  utl::Functor::Shred< TVector, TOutput >
 
struct  utl::Functor::Sign< T >
 
struct  utl::Functor::Sign< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Sin< T >
 
struct  utl::Functor::Sin< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Sqrt< T >
 
struct  utl::Functor::Sqrt< utl::NDArray< T, Dim > >
 
struct  utl::Functor::Square< T >
 
struct  utl::Functor::Square< utl::NDArray< T, Dim > >
 
class  utl::Functor::Sum< TVector, TOutput >
 
struct  utl::Functor::Tan< T >
 
struct  utl::Functor::Tan< utl::NDArray< T, Dim > >
 
class  utl::Functor::TwoNorm< TVector, TOutput >
 
class  utl::Functor::VectorFunctorBase< TVector, TOutput >
 
class  utl::Functor::VectorFunctorWrapper< TFunctor, TVector, TOutput >
 
class  utl::Functor::VectorMultiVariableFunctionWrapper< TFunction, TVector, TOutput >
 
class  utl::Functor::VectorUnaryFunctionWrapper< TFunction, TVector, TOutput >
 
class  utl::Functor::ZeroNorm< TVector, TOutput >
 

Namespaces

 utl
 
 utl::Functor
 

Macros

#define utlBinaryFunctorBaseMacro(name, realFunc)
 
#define utlBinaryFunctorMacro(name, realFunc)
 
#define utlUnaryFunctorBaseMacro(name, realFunc)
 
#define utlUnaryFunctorMacro(name, realFunc)
 
#define utlVectorToScalarFunctorMacro(name, funcName)
 

Functions

template<class ExprT >
auto utl::Abs (const ExprT &expr) -> decltype(utl::F< utl::Functor::Abs< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Acos (const ExprT &expr) -> decltype(utl::F< utl::Functor::Acos< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Asin (const ExprT &expr) -> decltype(utl::F< utl::Functor::Asin< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Atan (const ExprT &expr) -> decltype(utl::F< utl::Functor::Atan< typename ExprT::ValueType > >(expr))
 
template<class TLeft >
auto utl::Atan2 (const TLeft &lhs, const ScalarExpr &rhs) -> decltype(utl::F< utl::Functor::Atan2< Expr2ValueType< TLeft, ScalarExpr >> >(lhs, rhs))
 
template<class TRight >
auto utl::Atan2 (const ScalarExpr &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Atan2< Expr2ValueType< ScalarExpr, TRight >> >(lhs, rhs))
 
template<class TLeft , class TRight >
auto utl::Atan2 (const TLeft &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Atan2< Expr2ValueType< TLeft, TRight >> >(lhs, rhs))
 
template<class ExprT >
auto utl::Conj (const ExprT &expr) -> decltype(utl::F< utl::Functor::Conj< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Cos (const ExprT &expr) -> decltype(utl::F< utl::Functor::Cos< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Cube (const ExprT &expr) -> decltype(utl::F< utl::Functor::Cube< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Exp (const ExprT &expr) -> decltype(utl::F< utl::Functor::Exp< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Exp2 (const ExprT &expr) -> decltype(utl::F< utl::Functor::Exp2< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Floor (const ExprT &expr) -> decltype(utl::F< utl::Functor::Floor< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Log (const ExprT &expr) -> decltype(utl::F< utl::Functor::Log< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Log10 (const ExprT &expr) -> decltype(utl::F< utl::Functor::Log10< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Log2 (const ExprT &expr) -> decltype(utl::F< utl::Functor::Log2< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::LRound (const ExprT &expr) -> decltype(utl::F< utl::Functor::LRound< typename ExprT::ValueType > >(expr))
 
template<class TLeft , class TRight >
auto utl::Max (const TLeft &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Max< Expr2ValueType< TLeft, TRight >> >(lhs, rhs))
 
template<class TLeft >
auto utl::Max (const TLeft &lhs, const ScalarExpr &rhs) -> decltype(utl::F< utl::Functor::Max< Expr2ValueType< TLeft, ScalarExpr >> >(lhs, rhs))
 
template<class TRight >
auto utl::Max (const ScalarExpr &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Max< Expr2ValueType< ScalarExpr, TRight >> >(lhs, rhs))
 
template<class TRight >
auto utl::Min (const ScalarExpr &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Min< Expr2ValueType< ScalarExpr, TRight >> >(lhs, rhs))
 
template<class TLeft >
auto utl::Min (const TLeft &lhs, const ScalarExpr &rhs) -> decltype(utl::F< utl::Functor::Min< Expr2ValueType< TLeft, ScalarExpr >> >(lhs, rhs))
 
template<class TLeft , class TRight >
auto utl::Min (const TLeft &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Min< Expr2ValueType< TLeft, TRight >> >(lhs, rhs))
 
template<class ExprT >
auto utl::Neg (const ExprT &expr) -> decltype(utl::F< utl::Functor::Neg< typename ExprT::ValueType > >(expr))
 
template<class TLeft >
auto utl::Pow (const TLeft &lhs, const ScalarExpr &rhs) -> decltype(utl::F< utl::Functor::Pow< Expr2ValueType< TLeft, ScalarExpr >> >(lhs, rhs))
 
template<class TRight >
auto utl::Pow (const ScalarExpr &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Pow< Expr2ValueType< ScalarExpr, TRight >> >(lhs, rhs))
 
template<class TLeft , class TRight >
auto utl::Pow (const TLeft &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Pow< Expr2ValueType< TLeft, TRight >> >(lhs, rhs))
 
template<class ExprT >
auto utl::Round (const ExprT &expr) -> decltype(utl::F< utl::Functor::Round< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Sign (const ExprT &expr) -> decltype(utl::F< utl::Functor::Sign< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Sin (const ExprT &expr) -> decltype(utl::F< utl::Functor::Sin< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Sqrt (const ExprT &expr) -> decltype(utl::F< utl::Functor::Sqrt< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Square (const ExprT &expr) -> decltype(utl::F< utl::Functor::Square< typename ExprT::ValueType > >(expr))
 
template<class ExprT >
auto utl::Tan (const ExprT &expr) -> decltype(utl::F< utl::Functor::Tan< typename ExprT::ValueType > >(expr))
 

Detailed Description

functors in utl

Author
Dr. Jian Cheng (JC), jian..nosp@m.chen.nosp@m.g.198.nosp@m.3@gm.nosp@m.ail.c.nosp@m.om

Definition in file utlFunctors.h.

Macro Definition Documentation

#define utlBinaryFunctorBaseMacro (   name,
  realFunc 
)
Value:
namespace Functor{ \
template<typename T> \
struct name \
{ \
UTL_ALWAYS_INLINE T operator()(const T a, const T b) const \
{ return realFunc(a, b); } \
UTL_ALWAYS_INLINE bool operator!=(const name &) const \
{ return false; } \
UTL_ALWAYS_INLINE bool operator==(const name & other) const \
{ return !( *this != other ); } \
}; \
}

macro to define binary functors in utl::Functor

Definition at line 69 of file utlFunctors.h.

#define utlBinaryFunctorMacro (   name,
  realFunc 
)
Value:
utlBinaryFunctorBaseMacro(name, realFunc) \
\
template<class TLeft, class TRight> \
auto name(const TLeft& lhs, const TRight& rhs) -> decltype(utl::F<utl::Functor::name<Expr2ValueType<TLeft,TRight>> >(lhs, rhs)) \
{ \
return utl::F<utl::Functor::name<Expr2ValueType<TLeft,TRight>> >(lhs, rhs); \
} \
template<class TLeft> \
auto name(const TLeft& lhs, const ScalarExpr& rhs) -> decltype(utl::F<utl::Functor::name<Expr2ValueType<TLeft,ScalarExpr>> >(lhs, rhs)) \
{ \
return utl::F<utl::Functor::name<Expr2ValueType<TLeft,ScalarExpr>> >(lhs, rhs); \
} \
template<class TRight> \
auto name(const ScalarExpr& lhs, const TRight& rhs) -> decltype(utl::F<utl::Functor::name<Expr2ValueType<ScalarExpr,TRight>> >(lhs, rhs)) \
{ \
return utl::F<utl::Functor::name<Expr2ValueType<ScalarExpr,TRight>> >(lhs, rhs); \
} \
ScalarExprBase< double > ScalarExpr
ScalarExprBase<double>
Definition: utlExpression.h:43
BinaryOpExpr< OP, TLeft, TRight > F(const Expr< TLeft, typename TLeft::ValueType > &lhs, const Expr< TRight, typename TRight::ValueType > &rhs)
#define utlBinaryFunctorBaseMacro(name, realFunc)
Definition: utlFunctors.h:69

macro to define binary functors in utl::Functor, then define functions in utl which can be used elementwisely for expressions.

Definition at line 85 of file utlFunctors.h.

#define utlUnaryFunctorBaseMacro (   name,
  realFunc 
)
Value:
namespace Functor{ \
template<typename T> \
struct name \
{ \
UTL_ALWAYS_INLINE T operator()(const T a) const \
{ return realFunc(a); } \
UTL_ALWAYS_INLINE bool operator!=(const name &) const \
{ return false; } \
UTL_ALWAYS_INLINE bool operator==(const name & other) const \
{ return !( *this != other ); } \
}; \
}

macro to define unary functors in utl::Functor

Definition at line 21 of file utlFunctors.h.

#define utlUnaryFunctorMacro (   name,
  realFunc 
)
Value:
utlUnaryFunctorBaseMacro(name, realFunc) \
\
template<class ExprT> \
auto name(const ExprT& expr) -> decltype(utl::F<utl::Functor::name<typename ExprT::ValueType> >(expr)) \
{ \
return utl::F<utl::Functor::name<typename ExprT::ValueType> >(expr); \
} \
\
namespace Functor{ \
template<typename T, unsigned Dim> \
struct name<utl::NDArray<T,Dim> > : public VectorFunctorBase<utl::NDArray<T,Dim>, utl::NDArray<T,Dim> > \
{ \
public: \
bool operator!=(const name & other) const \
{ return false; } \
bool operator==(const name & other) const \
{ return !( *this != other ); } \
void operator=(const name & other) {} \
inline utl::NDArray<T,Dim> operator()( const utl::NDArray<T,Dim> & A ) const \
{ \
return utl::name(A); \
} \
\
int GetOutputDimension(const int inSize) const \
{ return inSize; } \
}; \
}
NDArray is a N-Dimensional array class (row-major, c version)
Definition: utlFunctors.h:131
#define utlUnaryFunctorBaseMacro(name, realFunc)
Definition: utlFunctors.h:21
BinaryOpExpr< OP, TLeft, TRight > F(const Expr< TLeft, typename TLeft::ValueType > &lhs, const Expr< TRight, typename TRight::ValueType > &rhs)

macro to define unary functors in utl::Functor, then define functions in utl which can be used elementwisely for expressions.

Definition at line 37 of file utlFunctors.h.

#define utlVectorToScalarFunctorMacro (   name,
  funcName 
)
Value:
namespace Functor{ \
template< class TVector, class TOutput=double > \
class name : public VectorFunctorBase<TVector,TOutput> \
{ \
public: \
bool operator!=(const name & other) const \
{ return false; } \
bool operator==(const name & other) const \
{ return !( *this != other ); } \
void operator=(const name & other) {} \
inline TOutput operator()( const TVector & A ) const \
{ \
return A.funcName(); \
} \
\
int GetOutputDimension(const int) const \
{ return 1; } \
}; \
}

define functors from utl::Vector to double

Definition at line 106 of file utlFunctors.h.