STK++ 0.9.13
STK::hidden::MultPointArray< Lhs, Rhs, Result > Struct Template Reference

This structure regroup the products between a point and different kind of array. More...

#include <STK_ArrayByVectorProduct.h>

Public Types

typedef Result::Type Type
 

Static Public Member Functions

template<class SubLhs , class SubRhs >
static void mult (SubLhs const &l, SubRhs const &r, Result &res)
 Compute the product res = l*r with l a point (a row-vector) and r a matrix using the standard formula $ \mathrm{res}_j = \sum_{i=1}^n l_i r_{ij} $.
 
static void run (ExprBase< Lhs > const &l, ExprBase< Rhs > const &r, Result &res)
 Compute the product res = l*r with l a point (a row-vector) and r a matrix using column decomposition.
 

Detailed Description

template<typename Lhs, typename Rhs, typename Result>
struct STK::hidden::MultPointArray< Lhs, Rhs, Result >

This structure regroup the products between a point and different kind of array.

Definition at line 126 of file STK_ArrayByVectorProduct.h.

Member Typedef Documentation

◆ Type

template<typename Lhs , typename Rhs , typename Result >
typedef Result::Type STK::hidden::MultPointArray< Lhs, Rhs, Result >::Type

Definition at line 128 of file STK_ArrayByVectorProduct.h.

Member Function Documentation

◆ mult()

template<typename Lhs , typename Rhs , typename Result >
template<class SubLhs , class SubRhs >
static void STK::hidden::MultPointArray< Lhs, Rhs, Result >::mult ( SubLhs const l,
SubRhs const r,
Result &  res 
)
inlinestatic

Compute the product res = l*r with l a point (a row-vector) and r a matrix using the standard formula $ \mathrm{res}_j = \sum_{i=1}^n l_i r_{ij} $.

Definition at line 133 of file STK_ArrayByVectorProduct.h.

134 {
135 // loop over the column of the right hand side
136 for (int j=r.beginCols(); j< r.endCols(); ++j)
137 {
138 Type sum(0); // compute dot product
139 for (int i=l.begin(); i<l.end(); ++i) { sum += l.elt(i) * r.elt(i,j); }
140 res.elt(j) += sum;
141 }
142 }
Arrays::SumOp< Lhs, Rhs >::result_type sum(Lhs const &lhs, Rhs const &rhs)
convenience function for summing two arrays

References STK::sum().

Referenced by STK::hidden::MultPointArray< Lhs, Rhs, Result >::run().

◆ run()

template<typename Lhs , typename Rhs , typename Result >
static void STK::hidden::MultPointArray< Lhs, Rhs, Result >::run ( ExprBase< Lhs > const l,
ExprBase< Rhs > const r,
Result &  res 
)
inlinestatic

Compute the product res = l*r with l a point (a row-vector) and r a matrix using column decomposition.

Definition at line 146 of file STK_ArrayByVectorProduct.h.

147 {
148 pointByArrayRowRange rowRange(r.beginRows(), pointByArrayRowSize_);
149 for(;rowRange.end()<r.endRows(); rowRange += pointByArrayRowSize_)
150 {
151 PointByArrayColRange colRange(r.beginCols(), pointByArrayColSize_); // create fixed size col range
152 for(; colRange.end() < r.endCols(); colRange += pointByArrayColSize_)
153 {
154 mult(l.sub(rowRange), r.sub(rowRange, colRange), res);
155 }
156 Range lastColRange(colRange.begin(), r.lastIdxCols(), 0);
157 mult(l.sub(rowRange), r.sub(rowRange, lastColRange ), res);
158 }
159 // end
160 Range lastRowRange(rowRange.begin(), r.lastIdxRows(), 0);
161 PointByArrayColRange colRange(r.beginCols(), pointByArrayColSize_); // create fixed size col range
162 for(; colRange.end() < r.endCols(); colRange += pointByArrayColSize_)
163 { mult(l.sub(lastRowRange), r.sub(lastRowRange, colRange), res);}
164 // last term
165 Range lastColRange(colRange.begin(), r.lastIdxCols(), 0);
166 mult(l.sub(lastRowRange), r.sub(lastRowRange, lastColRange ), res);
167 }
TRange< pointByArrayRowSize_ > pointByArrayRowRange
TRange< pointByArrayColSize_ > PointByArrayColRange
TRange< UnknownSize > Range
Definition STK_Range.h:59
static void mult(SubLhs const &l, SubRhs const &r, Result &res)
Compute the product res = l*r with l a point (a row-vector) and r a matrix using the standard formula...

References STK::hidden::MultPointArray< Lhs, Rhs, Result >::mult(), STK::hidden::pointByArrayColSize_, and STK::hidden::pointByArrayRowSize_.


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