35#ifndef STK_PRODUCTDISPATCHER_H
36#define STK_PRODUCTDISPATCHER_H
46template<
typename>
class Array2DUpperTriangular;
47template<
typename>
class Array2DLowerTriangular;
48template<
typename Type,
int SizeRows_,
int SizeCols_,
bool Orient_>
class CAllocator;
50template<
typename>
class SArray2DUpperTriangular;
51template<
typename>
class SArray2DLowerTriangular;
52template<
typename>
class SArray2D;
60template<
typename Lhs,
typename Rhs,
int RStructure_>
74 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
75 , useForRows_ = Arrays::useLhsSize_
76 , useForCols_ = Arrays::useRhsSize_
91template<
typename Lhs,
typename Rhs>
96 structure_ = Arrays::array2D_,
106 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
107 , useForRows_ = Arrays::useLhsSize_
108 , useForCols_ =
Traits<
Lhs>::sizeCols_ !=
UnknownSize ? Arrays::useLhsSize_ : Arrays::useRhsSize_
114 typedef typename If< storage_ ==
int(Arrays::dense_)
122template<
typename Lhs,
typename Rhs,
int RStructure_>
127 structure_ = Arrays::array2D_,
138 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
140 , useForCols_ = Arrays::useRhsSize_
146 typedef typename If< storage_ ==
int(Arrays::dense_)
154template<
typename Lhs,
typename Rhs,
int LStructure_>
159 structure_ = Arrays::array2D_,
171 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
172 , useForRows_ = Arrays::useLhsSize_
179 typedef typename If< storage_ ==
int(Arrays::dense_)
185template<
typename Lhs,
typename Rhs>
190 structure_ = Arrays::square_,
201 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
202 , useForRows_ =
Traits<
Lhs>::sizeRows_ !=
UnknownSize ? Arrays::useLhsSize_ : Arrays::useRhsSize_
203 , useForCols_ =
Traits<
Rhs>::sizeCols_ !=
UnknownSize ? Arrays::useRhsSize_ : Arrays::useLhsSize_
209 typedef typename If< storage_ ==
int(Arrays::dense_)
217template<
typename Lhs,
typename Rhs,
int RStructure_>
222 structure_ = Arrays::array2D_,
231 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
232 , useForRows_ = Arrays::useLhsSize_
233 , useForCols_ = Arrays::useRhsSize_
239 typedef typename If< storage_ ==
int(Arrays::dense_)
245template<
typename Lhs,
typename Rhs>
250 structure_ = Arrays::array2D_,
260 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
261 , useForRows_ = Arrays::useLhsSize_
262 , useForCols_ =
Traits<
Lhs>::sizeCols_ !=
UnknownSize ? Arrays::useLhsSize_ : Arrays::useRhsSize_
268 typedef typename If< storage_ ==
int(Arrays::dense_)
274template<
typename Lhs,
typename Rhs>
279 structure_ = Arrays::lower_triangular_,
288 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
289 , useForRows_ = Arrays::useLhsSize_
290 , useForCols_ = Arrays::useRhsSize_
295 typedef typename If< storage_ ==
int(Arrays::dense_)
303template<
typename Lhs,
typename Rhs,
int RStructure_>
308 structure_ = Arrays::array2D_,
317 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
318 , useForRows_ = Arrays::useLhsSize_
319 , useForCols_ = Arrays::useRhsSize_
324 typedef typename If< storage_ ==
int(Arrays::dense_)
330template<
typename Lhs,
typename Rhs>
335 structure_ = Arrays::array2D_,
345 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
346 , useForRows_ = Arrays::useLhsSize_
347 , useForCols_ =
Traits<
Lhs>::sizeCols_ !=
UnknownSize ? Arrays::useLhsSize_ : Arrays::useRhsSize_
352 typedef typename If< storage_ ==
int(Arrays::dense_)
358template<
typename Lhs,
typename Rhs>
363 structure_ = Arrays::upper_triangular_,
372 ?
int(Arrays::dense_) :
int(Arrays::sparse_)
373 , useForRows_ = Arrays::useLhsSize_
374 , useForCols_ = Arrays::useRhsSize_
379 typedef typename If< storage_ ==
int(Arrays::dense_)
393template <
class Lhs,
class Rhs,
class Result
411 if (lhs.sizeRows()<rhs.sizeCols())
413 for (
int j=rhs.beginCols();
j< rhs.endCols();
j++)
418 { MultCoeff::dot(lhs, rhs,
res,
i,
j);}
423 for (
int i=lhs.beginRows();
i< lhs.endRows();
i++)
427 { MultCoeff::dot(lhs, rhs,
res,
i,
j);}
436template <
class Lhs,
class Rhs,
class Result>
441 structure_ = Arrays::array2D_,
455template <
class Lhs,
class Rhs,
class Result>
460 structure_ = Arrays::array2D_,
474template <
class Lhs,
class Rhs,
class Result>
479 structure_ = Arrays::square_,
493template <
class Lhs,
class Rhs,
class Result>
498 structure_ = Arrays::array2D_,
512template <
class Lhs,
class Rhs,
class Result>
517 structure_ = Arrays::vector_,
527template <
class Lhs,
class Rhs,
class Result>
532 structure_ = Arrays::vector_,
542template <
class Lhs,
class Rhs,
class Result,
int lhsStructure_>
547 structure_ = Arrays::vector_,
556 for (
int i=lhs.beginRows();
i< lhs.endRows();
i++)
557 { MultCoeff::dot(lhs, rhs,
res,
i);}
562template <
class Lhs,
class Rhs,
class Result,
int RhsStructure_>
567 structure_ = Arrays::point_,
576 for (
int j=rhs.beginCols();
j< rhs.endCols();
j++)
577 { MultCoeff::dot(lhs, rhs,
res,
j);}
581template <
class Lhs,
class Rhs,
class Result>
586 structure_ = Arrays::point_,
596template <
class Lhs,
class Rhs,
class Result>
601 structure_ = Arrays::point_,
In this file we implement the General Array by Array product.
In this file we implement the General Array by Vector product.
In this file we implement the raw static methods used by the products methods.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
int begin() const
get the first index of the TRange.
Index sub-vector region: Specialization when the size is unknown.
int end() const
get the ending index of the TRange.
@ dense_
dense matrix/vector/array/expression
@ array2D_
general matrix/array/expression
@ square_
square matrix/array/expression
const int UnknownSize
This value means that an integer is not known at compile-time, and that instead the value is stored i...
The namespace STK is the main domain space of the Statistical ToolKit project.
Methods to use for C=AB with A divided in blocks and B divided in panels.
This structure regroup the methods to used after block multiplication in order to perform the product...
This structure regroup the products between a point and different kind of array.
Methods to use for C=AB with A divided in panels and B divided in blocks.
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
static void run(Lhs const &l, Rhs const &r, Result &res)
static void run(Lhs const &l, Rhs const &r, Result &res)
MultCoefImpl< Lhs, Rhs, Result > MultCoeff
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
MultCoefImpl< Lhs, Rhs, Result > MultCoeff
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
Dispatcher allowing to choose th e way to multiply two expressions.
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
loop over the columns of rhs first
MultCoefImpl< Lhs, Rhs, Result > MultCoeff
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
RemoveConst< Type >::Type const & TypeConst
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
RemoveConst< Type >::Type const & TypeConst
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
RemoveConst< Type >::Type const & TypeConst
If< storage_==int(Arrays::dense_), Array2DLowerTriangular< Type >, SArray2DLowerTriangular< Type > >::Result Allocator
RemoveConst< Type >::Type const & TypeConst
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
RemoveConst< Type >::Type const & TypeConst
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
RemoveConst< Type >::Type const & TypeConst
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
RemoveConst< Type >::Type const & TypeConst
RemoveConst< Type >::Type const & TypeConst
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
If< storage_==int(Arrays::dense_), Array2DUpperTriangular< Type >, SArray2DUpperTriangular< Type > >::Result Allocator
RemoveConst< Type >::Type const & TypeConst
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
RemoveConst< Type >::Type const & TypeConst
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
If< storage_==int(Arrays::dense_), CAllocator< Type, sizeRows_, sizeCols_, orient_ >, SArray2D< Type > >::Result Allocator
RemoveConst< Type >::Type const & TypeConst
hidden::Promote< typenameLhs::Type, typenameRhs::Type >::result_type Type
Methods to use for C=AV with A a general matrix and V a vector.