STK++ 0.9.13
STK::ApplyFunctorByRow< Derived, Functor > Struct Template Reference

class allowing to apply the Functor Functor on each rows of an expression. More...

#include <STK_ExprBaseFunctors.h>

Public Types

enum  { sizeRows_ = Derived::sizeRows_ , sizeCols_ = Derived::sizeCols_ }
 
typedef Derived::Type Type
 
typedef CArrayVector< Type, sizeRows_Col
 

Public Member Functions

 ApplyFunctorByRow (ExprBase< Derived > const &lhs)
 constructor
 
Col operator() ()
 
Col operator() (bool option)
 
template<class OtherCol >
Col operator() (OtherCol const &value, bool option)
 

Protected Attributes

Derived constlhs_
 
Col res_
 

Detailed Description

template<typename Derived, typename Functor>
struct STK::ApplyFunctorByRow< Derived, Functor >

class allowing to apply the Functor Functor on each rows of an expression.

Definition at line 238 of file STK_ExprBaseFunctors.h.

Member Typedef Documentation

◆ Col

template<typename Derived , typename Functor >
typedef CArrayVector<Type, sizeRows_> STK::ApplyFunctorByRow< Derived, Functor >::Col

Definition at line 246 of file STK_ExprBaseFunctors.h.

◆ Type

template<typename Derived , typename Functor >
typedef Derived::Type STK::ApplyFunctorByRow< Derived, Functor >::Type

Definition at line 240 of file STK_ExprBaseFunctors.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename Derived , typename Functor >
anonymous enum
Enumerator
sizeRows_ 
sizeCols_ 

Definition at line 241 of file STK_ExprBaseFunctors.h.

242 {
243 sizeRows_ = Derived::sizeRows_,
244 sizeCols_ = Derived::sizeCols_
245 };

Constructor & Destructor Documentation

◆ ApplyFunctorByRow()

template<typename Derived , typename Functor >
STK::ApplyFunctorByRow< Derived, Functor >::ApplyFunctorByRow ( ExprBase< Derived > const lhs)
inline

constructor

Definition at line 249 of file STK_ExprBaseFunctors.h.

250 : lhs_(lhs.asDerived())
251 , res_(lhs_.rows())
252 {}

Member Function Documentation

◆ operator()() [1/3]

template<typename Derived , typename Functor >
Col STK::ApplyFunctorByRow< Derived, Functor >::operator() ( )
inline

Definition at line 253 of file STK_ExprBaseFunctors.h.

254 {
255 for (int i= lhs_.beginRows(); i < lhs_.endRows(); ++i)
256 { res_[i] = Functor(lhs_.row(i))();}
257 return res_;
258 }

References STK::ApplyFunctorByRow< Derived, Functor >::lhs_, and STK::ApplyFunctorByRow< Derived, Functor >::res_.

◆ operator()() [2/3]

template<typename Derived , typename Functor >
Col STK::ApplyFunctorByRow< Derived, Functor >::operator() ( bool  option)
inline

Definition at line 259 of file STK_ExprBaseFunctors.h.

260 {
261 for (int j= lhs_.beginRows(); j < lhs_.endRows(); ++j)
262 { res_[j] = Functor(lhs_.row(j))( option);}
263 return res_;
264 }

References STK::ApplyFunctorByRow< Derived, Functor >::lhs_, and STK::ApplyFunctorByRow< Derived, Functor >::res_.

◆ operator()() [3/3]

template<typename Derived , typename Functor >
template<class OtherCol >
Col STK::ApplyFunctorByRow< Derived, Functor >::operator() ( OtherCol const value,
bool  option 
)
inline

Definition at line 266 of file STK_ExprBaseFunctors.h.

267 {
268#ifdef STK_BOUNDS_CHECK
269 if (lhs_.rows() != value.range()) STKRUNTIME_ERROR_NO_ARG(ApplyFunctorByRow::operator(value,option),lhs_.rows()!=value.rows());
270#endif
271 for (int j= lhs_.beginRows(); j < lhs_.endRows(); ++j)
272 { res_[j] = Functor(lhs_.row(j))(value[j], option);}
273 return res_;
274 }
#define STKRUNTIME_ERROR_NO_ARG(Where, Error)
Definition STK_Macros.h:138

References STK::ApplyFunctorByRow< Derived, Functor >::lhs_, STK::ApplyFunctorByRow< Derived, Functor >::res_, and STKRUNTIME_ERROR_NO_ARG.

Member Data Documentation

◆ lhs_

◆ res_


The documentation for this struct was generated from the following file: