STK++ 0.9.13
STK::Arrays::SumOp< Lhs, Rhs > Struct Template Reference

Array sum (by coefficient) Perform the matrix sum coefficient by coefficient of the Array lhs by the Array rhs. More...

#include <STK_Array2D_Functors.h>

Public Types

enum  { NbParam_ = 2 }
 
typedef Lhs constparam1_type
 
typedef Rhs constparam2_type
 
typedef hidden::Promote< typenamehidden::Traits< Lhs >::Type, typenamehidden::Traits< Rhs >::Type >::result_type Type
 
typedef hidden::BinaryReturnArray2DType< typenamehidden::Promote< typenamehidden::Traits< Lhs >::Type, typenamehidden::Traits< Rhs >::Type >::result_type, hidden::Traits< Lhs >::structure_, hidden::Traits< Rhs >::structure_ >::result_type result_type
 

Public Member Functions

 SumOp (ExprBase< Lhs > const &lhs, ExprBase< Rhs > const &rhs)
 
result_type operator() ()
 

Protected Attributes

param1_type lhs_
 
param2_type rhs_
 
Range rows_
 
Range cols_
 
result_type res_
 

Detailed Description

template<typename Lhs, typename Rhs>
struct STK::Arrays::SumOp< Lhs, Rhs >

Array sum (by coefficient) Perform the matrix sum coefficient by coefficient of the Array lhs by the Array rhs.

Definition at line 223 of file STK_Array2D_Functors.h.

Member Typedef Documentation

◆ param1_type

template<typename Lhs , typename Rhs >
typedef Lhs const& STK::Arrays::SumOp< Lhs, Rhs >::param1_type

Definition at line 226 of file STK_Array2D_Functors.h.

◆ param2_type

template<typename Lhs , typename Rhs >
typedef Rhs const& STK::Arrays::SumOp< Lhs, Rhs >::param2_type

Definition at line 227 of file STK_Array2D_Functors.h.

◆ result_type

template<typename Lhs , typename Rhs >
typedef hidden::BinaryReturnArray2DType<typenamehidden::Promote<typenamehidden::Traits<Lhs>::Type,typenamehidden::Traits<Rhs>::Type>::result_type,hidden::Traits<Lhs>::structure_,hidden::Traits<Rhs>::structure_>::result_type STK::Arrays::SumOp< Lhs, Rhs >::result_type

Definition at line 229 of file STK_Array2D_Functors.h.

◆ Type

template<typename Lhs , typename Rhs >
typedef hidden::Promote<typenamehidden::Traits<Lhs>::Type,typenamehidden::Traits<Rhs>::Type>::result_type STK::Arrays::SumOp< Lhs, Rhs >::Type

Definition at line 228 of file STK_Array2D_Functors.h.

Member Enumeration Documentation

◆ anonymous enum

Enumerator
NbParam_ 

Definition at line 225 of file STK_Array2D_Functors.h.

Constructor & Destructor Documentation

◆ SumOp()

template<typename Lhs , typename Rhs >
STK::Arrays::SumOp< Lhs, Rhs >::SumOp ( ExprBase< Lhs > const lhs,
ExprBase< Rhs > const rhs 
)
inline

Definition at line 231 of file STK_Array2D_Functors.h.

232 : lhs_(lhs.asDerived()), rhs_(rhs.asDerived())
233 , rows_(inf(lhs_.rows(), rhs_.rows()))
234 , cols_(inf(lhs_.cols(), rhs_.cols()))
235 , res_()
236 {}
Range inf(TRange< SizeI_ > const &I, TRange< SizeJ_ > const &J)
compute inf(I,J).
Definition STK_Range.h:477

Member Function Documentation

◆ operator()()

template<typename Lhs , typename Rhs >
result_type STK::Arrays::SumOp< Lhs, Rhs >::operator() ( )
inline

Definition at line 237 of file STK_Array2D_Functors.h.

238 {
239 res_.resize(rows_, cols_); res_ = Type();
240 Range cols = inf(cols_, lhs_.cols());
241 for (int j= cols.begin(); j < cols.end(); ++j)
242 {
243 Range rows = inf(rows_, lhs_.rangeRowsInCol(j));
244 for (int i= rows.begin(); i< rows.end(); ++i)
245 { res_(i,j) += lhs_(i,j);}
246 }
247 cols = inf(cols_, rhs_.cols());
248 for (int j= cols.begin(); j < cols.end(); ++j)
249 {
250 Range rows = inf(rows_, rhs_.rangeRowsInCol(j));
251 for (int i= rows.begin(); i< rows.end(); ++i)
252 { res_(i,j) += rhs_(i,j);}
253 }
254 return res_;
255 }
TRange< UnknownSize > Range
Definition STK_Range.h:59
hidden::Promote< typenamehidden::Traits< Lhs >::Type, typenamehidden::Traits< Rhs >::Type >::result_type Type

References STK::RangeBase< Derived >::begin(), STK::Arrays::SumOp< Lhs, Rhs >::cols_, STK::TRange< UnknownSize >::end(), STK::inf(), STK::Arrays::SumOp< Lhs, Rhs >::lhs_, STK::Arrays::SumOp< Lhs, Rhs >::res_, STK::Arrays::SumOp< Lhs, Rhs >::rhs_, and STK::Arrays::SumOp< Lhs, Rhs >::rows_.

Member Data Documentation

◆ cols_

template<typename Lhs , typename Rhs >
Range STK::Arrays::SumOp< Lhs, Rhs >::cols_
protected

Definition at line 260 of file STK_Array2D_Functors.h.

Referenced by STK::Arrays::SumOp< Lhs, Rhs >::operator()().

◆ lhs_

template<typename Lhs , typename Rhs >
param1_type STK::Arrays::SumOp< Lhs, Rhs >::lhs_
protected

Definition at line 257 of file STK_Array2D_Functors.h.

Referenced by STK::Arrays::SumOp< Lhs, Rhs >::operator()().

◆ res_

template<typename Lhs , typename Rhs >
result_type STK::Arrays::SumOp< Lhs, Rhs >::res_
protected

Definition at line 261 of file STK_Array2D_Functors.h.

Referenced by STK::Arrays::SumOp< Lhs, Rhs >::operator()().

◆ rhs_

template<typename Lhs , typename Rhs >
param2_type STK::Arrays::SumOp< Lhs, Rhs >::rhs_
protected

Definition at line 258 of file STK_Array2D_Functors.h.

Referenced by STK::Arrays::SumOp< Lhs, Rhs >::operator()().

◆ rows_

template<typename Lhs , typename Rhs >
Range STK::Arrays::SumOp< Lhs, Rhs >::rows_
protected

Definition at line 259 of file STK_Array2D_Functors.h.

Referenced by STK::Arrays::SumOp< Lhs, Rhs >::operator()().


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