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

Array multiplication Perform the matrix product 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::ProductArray2DReturnType< Type, Lhs::structure_, Rhs::structure_ >::result_type result_type
 

Public Member Functions

 MultOp (ExprBase< Lhs > const &lhs, ExprBase< Rhs > const &rhs)
 
result_type operator() ()
 
template<typename Weights >
result_type operator() (ExprBase< Weights > const &weights)
 

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::MultOp< Lhs, Rhs >

Array multiplication Perform the matrix product of the Array lhs by the Array rhs.

Definition at line 395 of file STK_Array2D_Functors.h.

Member Typedef Documentation

◆ param1_type

template<typename Lhs , typename Rhs >
typedef Lhs STK::Arrays::MultOp< Lhs, Rhs >::param1_type

Definition at line 398 of file STK_Array2D_Functors.h.

◆ param2_type

template<typename Lhs , typename Rhs >
typedef Rhs STK::Arrays::MultOp< Lhs, Rhs >::param2_type

Definition at line 399 of file STK_Array2D_Functors.h.

◆ result_type

template<typename Lhs , typename Rhs >
typedef hidden::ProductArray2DReturnType<Type,Lhs::structure_,Rhs::structure_>::result_type STK::Arrays::MultOp< Lhs, Rhs >::result_type

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

Definition at line 400 of file STK_Array2D_Functors.h.

Member Enumeration Documentation

◆ anonymous enum

Enumerator
NbParam_ 

Definition at line 397 of file STK_Array2D_Functors.h.

Constructor & Destructor Documentation

◆ MultOp()

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

Definition at line 403 of file STK_Array2D_Functors.h.

404 : lhs_(lhs.asDerived()), rhs_(rhs.asDerived())
405 , rows_(lhs_.rows())
406 , cols_(rhs_.cols())
407 , res_()
408 {}
param2_type const & rhs_
param1_type const & lhs_

Member Function Documentation

◆ operator()() [1/2]

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

Definition at line 410 of file STK_Array2D_Functors.h.

411 {
412 res_.resize(rows_, cols_);
413 // for all cols and for all rows
414 for (int j=res_.beginCols(); j<res_.endCols(); j++)
415 {
416 Integer const end = res_.rangeRowsInCol(j).end();
417 for (int i=res_.rangeRowsInCol(j).begin(); i<end; i++)
418 { res_(i, j) = dot(lhs_.row(i), rhs_.col(j));}
419 }
420 return res_;
421 }
Real dot(ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y)
Compute the dot product.
int Integer
STK fundamental type of integer values.

References STK::Arrays::MultOp< Lhs, Rhs >::cols_, STK::dot(), STK::Arrays::MultOp< Lhs, Rhs >::lhs_, STK::Arrays::MultOp< Lhs, Rhs >::res_, STK::Arrays::MultOp< Lhs, Rhs >::rhs_, and STK::Arrays::MultOp< Lhs, Rhs >::rows_.

◆ operator()() [2/2]

template<typename Lhs , typename Rhs >
template<typename Weights >
result_type STK::Arrays::MultOp< Lhs, Rhs >::operator() ( ExprBase< Weights > const weights)
inline

Definition at line 423 of file STK_Array2D_Functors.h.

424 {
425 res_.resize(rows_, cols_);
426 // for all cols and for all rows
427 for (int j=res_.beginCols(); j<res_.endCols(); j++)
428 {
429 Integer const end = res_.rangeRowsInCol(j).end();
430 for (int i=res_.rangeRowsInCol(j).begin(); i<end; i++)
431 { res_(i, j) = weightedDot(lhs_.row(i), rhs_.col(j), weights);}
432 }
433 return res_;
434 }
Real weightedDot(ExprBase< Container1D1 > const &x, ExprBase< Container1D2 > const &y, ExprBase< Container1D3 > const &w)
Compute the dot product.

References STK::Arrays::MultOp< Lhs, Rhs >::cols_, STK::Arrays::MultOp< Lhs, Rhs >::lhs_, STK::Arrays::MultOp< Lhs, Rhs >::res_, STK::Arrays::MultOp< Lhs, Rhs >::rhs_, STK::Arrays::MultOp< Lhs, Rhs >::rows_, and STK::weightedDot().

Member Data Documentation

◆ cols_

◆ lhs_

◆ res_

◆ rhs_

◆ rows_


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