STK++ 0.9.13
STK::ApplyWeightedFunctorByRow< 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

 ApplyWeightedFunctorByRow (ExprBase< Derived > const &lhs)
 constructor
 
template<typename Weights >
Col operator() (ExprBase< Weights > const &w)
 
template<typename Weights >
Col operator() (ExprBase< Weights > const &w, bool option)
 
template<typename Weights , typename OtherCol >
Col operator() (ExprBase< Weights > const &w, ExprBase< OtherCol > const &value, bool option)
 

Protected Attributes

Derived constlhs_
 
Col res_
 

Detailed Description

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

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

Definition at line 284 of file STK_ExprBaseFunctors.h.

Member Typedef Documentation

◆ Col

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

Definition at line 292 of file STK_ExprBaseFunctors.h.

◆ Type

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

Definition at line 286 of file STK_ExprBaseFunctors.h.

Member Enumeration Documentation

◆ anonymous enum

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

Definition at line 287 of file STK_ExprBaseFunctors.h.

288 {
289 sizeRows_ = Derived::sizeRows_,
290 sizeCols_ = Derived::sizeCols_
291 };

Constructor & Destructor Documentation

◆ ApplyWeightedFunctorByRow()

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

constructor

Definition at line 295 of file STK_ExprBaseFunctors.h.

296 : lhs_(lhs.asDerived())
297 , res_(lhs_.rows())
298 {}

Member Function Documentation

◆ operator()() [1/3]

template<typename Derived , typename Functor >
template<typename Weights >
Col STK::ApplyWeightedFunctorByRow< Derived, Functor >::operator() ( ExprBase< Weights > const w)
inline

Definition at line 300 of file STK_ExprBaseFunctors.h.

301 {
302 for (int i= lhs_.beginRows(); i < lhs_.endRows(); ++i)
303 { res_[i] = Functor(lhs_.row(i))(w);}
304 return res_;
305 }

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

◆ operator()() [2/3]

template<typename Derived , typename Functor >
template<typename Weights >
Col STK::ApplyWeightedFunctorByRow< Derived, Functor >::operator() ( ExprBase< Weights > const w,
bool  option 
)
inline

Definition at line 307 of file STK_ExprBaseFunctors.h.

308 {
309 for (int j= lhs_.beginRows(); j < lhs_.endRows(); ++j)
310 { res_[j] = Functor(lhs_.row(j))(w, option);}
311 return res_;
312 }

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

◆ operator()() [3/3]

template<typename Derived , typename Functor >
Col STK::ApplyWeightedFunctorByRow< Derived, Functor >::operator() ( ExprBase< Weights > const w,
ExprBase< OtherCol > const value,
bool  option 
)
inline

Definition at line 314 of file STK_ExprBaseFunctors.h.

315 {
316#ifdef STK_BOUNDS_CHECK
317 if (lhs_.rows() != value.range()) STKRUNTIME_ERROR_NO_ARG(ApplyFunctorByRow::operator(w,value,option),lhs_.rows()!=value.rows());
318#endif
319 for (int j= lhs_.beginRows(); j < lhs_.endRows(); ++j)
320 { res_[j] = Functor(lhs_.row(j))(w, value[j], option);}
321 return res_;
322 }
#define STKRUNTIME_ERROR_NO_ARG(Where, Error)
Definition STK_Macros.h:138

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

Member Data Documentation

◆ lhs_

◆ res_


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