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

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

#include <STK_Array2D_Functors.h>

Public Types

enum  { NbParam_ = 2 }
 
typedef Lhs param1_type
 
typedef Rhs param2_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

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

Protected Attributes

param1_type constlhs_
 
param2_type constrhs_
 
Range rows_
 
Range cols_
 
result_type res_
 

Detailed Description

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

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

Definition at line 270 of file STK_Array2D_Functors.h.

Member Typedef Documentation

◆ param1_type

Definition at line 273 of file STK_Array2D_Functors.h.

◆ param2_type

Definition at line 274 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::DifferenceOp< Lhs, Rhs >::result_type

Definition at line 276 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::DifferenceOp< Lhs, Rhs >::Type

Definition at line 275 of file STK_Array2D_Functors.h.

Member Enumeration Documentation

◆ anonymous enum

Enumerator
NbParam_ 

Definition at line 272 of file STK_Array2D_Functors.h.

Constructor & Destructor Documentation

◆ DifferenceOp()

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

Definition at line 278 of file STK_Array2D_Functors.h.

279 : lhs_(lhs.asDerived()), rhs_(rhs.asDerived())
280 , rows_(inf(lhs_.rows(), rhs_.rows()))
281 , cols_(inf(lhs_.cols(), rhs_.cols()))
282 , res_()
283 {}
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::DifferenceOp< Lhs, Rhs >::operator() ( )
inline

Definition at line 284 of file STK_Array2D_Functors.h.

285 {
286 res_.resize(rows_, cols_); res_ = Type();
287 Range cols = inf(cols_, lhs_.cols());
288 for (int j= cols.begin(); j< cols.end(); ++j)
289 {
290 Range rows = inf(rows_, lhs_.rangeRowsInCol(j));
291 for (int i= rows.begin(); i< rows.end(); ++i)
292 { res_(i,j) += lhs_(i,j);}
293 }
294 cols = inf(cols_, rhs_.cols());
295 for (int j= cols.begin(); j< cols.end(); ++j)
296 {
297 Range rows = inf(rows_, rhs_.rangeRowsInCol(j));
298 for (int i= rows.begin(); i< rows.end(); ++i)
299 { res_(i,j) -= rhs_(i,j);}
300 }
301 return res_;
302 }
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::DifferenceOp< Lhs, Rhs >::cols_, STK::TRange< UnknownSize >::end(), STK::inf(), STK::Arrays::DifferenceOp< Lhs, Rhs >::lhs_, STK::Arrays::DifferenceOp< Lhs, Rhs >::res_, STK::Arrays::DifferenceOp< Lhs, Rhs >::rhs_, and STK::Arrays::DifferenceOp< Lhs, Rhs >::rows_.

Member Data Documentation

◆ cols_

◆ lhs_

◆ res_

◆ rhs_

◆ rows_


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