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

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

#include <STK_ExprBaseFunctors.h>

Public Types

enum  { sizeRows_ = Derived::sizeRows_ , sizeCols_ = Derived::sizeCols_ }
 
typedef Derived::Type Type
 
typedef CArrayPoint< Type, sizeCols_Row
 

Public Member Functions

 ApplyFunctorByCol (ExprBase< Derived > const &lhs)
 constructor
 
Row operator() ()
 
Row operator() (bool option)
 
template<class OtherRow >
Row operator() (OtherRow const &value, bool option)
 

Protected Attributes

Derived constlhs_
 
Row res_
 

Detailed Description

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

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

Definition at line 131 of file STK_ExprBaseFunctors.h.

Member Typedef Documentation

◆ Row

template<typename Derived , typename Functor >
typedef CArrayPoint<Type, sizeCols_> STK::ApplyFunctorByCol< Derived, Functor >::Row

Definition at line 139 of file STK_ExprBaseFunctors.h.

◆ Type

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

Definition at line 133 of file STK_ExprBaseFunctors.h.

Member Enumeration Documentation

◆ anonymous enum

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

Definition at line 134 of file STK_ExprBaseFunctors.h.

135 {
136 sizeRows_ = Derived::sizeRows_,
137 sizeCols_ = Derived::sizeCols_
138 };

Constructor & Destructor Documentation

◆ ApplyFunctorByCol()

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

constructor

Definition at line 142 of file STK_ExprBaseFunctors.h.

143 : lhs_(lhs.asDerived())
144 , res_(lhs_.cols())
145 {}

Member Function Documentation

◆ operator()() [1/3]

template<typename Derived , typename Functor >
Row STK::ApplyFunctorByCol< Derived, Functor >::operator() ( )
inline
Returns
the applied functor by column

Definition at line 147 of file STK_ExprBaseFunctors.h.

148 {
149 for (int j= lhs_.beginCols(); j < lhs_.endCols(); ++j)
150 { res_[j] = Functor(lhs_.col(j))();}
151 return res_;
152 }

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

◆ operator()() [2/3]

template<typename Derived , typename Functor >
Row STK::ApplyFunctorByCol< Derived, Functor >::operator() ( bool  option)
inline
Returns
the applied functor by column

Definition at line 154 of file STK_ExprBaseFunctors.h.

155 {
156 for (int j= lhs_.beginCols(); j < lhs_.endCols(); ++j)
157 { res_[j] = Functor(lhs_.col(j))( option);}
158 return res_;
159 }

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

◆ operator()() [3/3]

template<typename Derived , typename Functor >
template<class OtherRow >
Row STK::ApplyFunctorByCol< Derived, Functor >::operator() ( OtherRow const value,
bool  option 
)
inline
Returns
the applied functor by column

Definition at line 162 of file STK_ExprBaseFunctors.h.

163 {
164#ifdef STK_BOUNDS_CHECK
165 if (lhs_.cols() != value.range())
166 STKRUNTIME_ERROR_NO_ARG(ApplyFunctorByCol::operator(value,option),lhs_.cols()!=value.range());
167#endif
168 for (int j= lhs_.beginCols(); j < lhs_.endCols(); ++j)
169 { res_[j] = Functor(lhs_.col(j))(value[j], option);}
170 return res_;
171 }
#define STKRUNTIME_ERROR_NO_ARG(Where, Error)
Definition STK_Macros.h:138

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

Member Data Documentation

◆ lhs_

◆ res_


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