36#ifndef STK_ARRAYBYARRAYPRODUCT_H
37#define STK_ARRAYBYARRAYPRODUCT_H
45template<
typename Lhs,
typename Rhs,
typename Result>
struct BlockByPanel;
46template<
typename Lhs,
typename Rhs,
typename Result>
struct PanelByBlock;
47template<
typename Lhs,
typename Rhs,
typename Result>
struct BlockPanelProduct;
48template<
typename Lhs,
typename Rhs,
typename Result>
struct PanelBlockProduct;
57template<
typename Lhs,
typename Rhs,
typename Result>
60 typedef typename Result::Type
Type;
71#ifdef STK_ARRAYS_DEBUG
72 stk_cout <<
_T(
"Entering BlockByPanel::run()\n");
104#pragma omp parallel for
115#pragma omp parallel for
203template<
typename Lhs,
typename Rhs,
typename Result>
206 typedef typename Result::Type
Type;
216#ifdef STK_ARRAYS_DEBUG
217 stk_cout <<
_T(
"Entering PanelByBlock::run()\n");
252#pragma omp parallel for
262#pragma omp parallel for
348template<
typename Lhs,
typename Rhs,
typename Result>
351 typedef typename Result::Type
Type;
361 stk_cout <<
_T(
"Entering BlockPanelProduct::run()\n");
381#pragma omp parallel for
397#pragma omp parallel for
418 template<
class SubLhs,
class SubRhs>
421 const int k= rhs.beginRows();
422 for (
int j=rhs.beginCols();
j<rhs.endCols(); ++
j)
424 int i = lhs.beginRows();
425 res.elt(
i,
j) += lhs(
i ,k) * rhs(k ,
j) + lhs(
i ,k+1) * rhs(k+1,
j)
426 + lhs(
i ,k+2) * rhs(k+2,
j) + lhs(
i ,k+3) * rhs(k+3,
j);
428 res.elt(
i,
j) += lhs(
i,k) * rhs(k ,
j) + lhs(
i,k+1) * rhs(k+1,
j)
429 + lhs(
i,k+2) * rhs(k+2,
j) + lhs(
i,k+3) * rhs(k+3,
j);
431 res.elt(
i,
j) += lhs(
i,k) * rhs(k ,
j) + lhs(
i,k+1) * rhs(k+1,
j)
432 + lhs(
i,k+2) * rhs(k+2,
j) + lhs(
i,k+3) * rhs(k+3,
j);
434 res.elt(
i,
j) += lhs(
i,k) * rhs(k ,
j) + lhs(
i,k+1) * rhs(k+1,
j)
435 + lhs(
i,k+2) * rhs(k+2,
j) + lhs(
i,k+3) * rhs(k+3,
j);
439 template<
class SubLhs,
class SubRhs>
442 const int k= rhs.beginRows();
443 for (
int j=rhs.beginCols();
j<rhs.endCols(); ++
j)
444 for(
int i=lhs.beginRows();
i<lhs.endRows(); ++
i)
445 res.elt(
i,
j) += lhs(
i,k ) * rhs(k ,
j) + lhs(
i,k+1) * rhs(k+1,
j)
446 + lhs(
i,k+2) * rhs(k+2,
j) + lhs(
i,k+3) * rhs(k+3,
j);
457template<
typename Lhs,
typename Rhs,
typename Result>
460 typedef typename Result::Type
Type;
469#ifdef STK_ARRAYS_DEBUG
470 stk_cout <<
_T(
"Entering PanelBlockProduct::run()\n");
490#pragma omp parallel for
506#pragma omp parallel for
528 template<
class SubLhs,
class SubRhs>
531 int const k= lhs.beginCols();
532 for (
int i=lhs.beginRows();
i<lhs.endRows(); ++
i)
534 int j = rhs.beginCols();
535 res.elt(
i,
j) += lhs(
i, k ) * rhs(k ,
j) + lhs(
i, k+1) * rhs(k+1,
j)
536 + lhs(
i, k+2) * rhs(k+2,
j) + lhs(
i, k+3) * rhs(k+3,
j);
538 res.elt(
i,
j) += lhs(
i, k ) * rhs(k ,
j) + lhs(
i, k+1) * rhs(k+1,
j)
539 + lhs(
i, k+2) * rhs(k+2,
j) + lhs(
i, k+3) * rhs(k+3,
j);
541 res.elt(
i,
j) += lhs(
i, k ) * rhs(k ,
j) + lhs(
i, k+1) * rhs(k+1,
j)
542 + lhs(
i, k+2) * rhs(k+2,
j) + lhs(
i, k+3) * rhs(k+3,
j);
544 res.elt(
i,
j) += lhs(
i, k ) * rhs(k ,
j) + lhs(
i, k+1) * rhs(k+1,
j)
545 + lhs(
i, k+2) * rhs(k+2,
j) + lhs(
i, k+3) * rhs(k+3,
j);
549 template<
class SubLhs,
class SubRhs>
552 const int k= lhs.beginCols();
553 for (
int i=lhs.beginRows();
i<lhs.endRows(); ++
i)
554 for (
int j=rhs.beginCols();
j<rhs.endCols(); ++
j)
555 res.elt(
i,
j) += lhs(
i, k ) * rhs(k ,
j) + lhs(
i, k+1) * rhs(k+1,
j)
556 + lhs(
i, k+2) * rhs(k+2,
j) + lhs(
i, k+3) * rhs(k+3,
j);
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
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.
hidden::MultCoefImpl< Lhs, Rhs, Result > MultCoeff
static void multBlockByPanel(Block< Type > const &block, Panel< Type > const &panel, Result &res, int iRow, int jCol)
Default dimension.
static void multBlockByPanel(Block< Type > const &block, Panel< Type > const &panel, Result &res, int iRow, int jCol, int pSize, int bSize)
with panel size given
static void multBlockByPanel(Block< Type > const &block, Panel< Type > const &panel, Result &res, int iRow, int jCol, int pSize)
with panel size given
hidden::CopySubArrayImpl< Rhs, Type > CopyRhsImpl
hidden::CopySubArrayImpl< Lhs, Type > CopyLhsImpl
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
Main method for matrices multiplication implementation.
hidden::MultImpl< Type > Cmult
Methods to use for C=AB with A divided in blocks and B divided in panels.
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
Main method for Matrices multiplication implementation.
static void multBlockByPanel(SubLhs const &lhs, SubRhs const &rhs, Result &res)
matrix product between a lhs block and a rhs panel
hidden::MultCoefImpl< Lhs, Rhs, Result > MultCoeff
static void multBlockPartByPanel(SubLhs const &lhs, SubRhs const &rhs, Result &res)
matrix product between a lhs block and a rhs panel
hidden::MultImpl< Type > Cmult
This structure regroup the methods to used for copying part of an array in a Block or a Panel.
static void arrayToPanel(Array const &m, Panel< Type > &panel, int iRow, int jCol)
copy a part of an array in a Panel
static void arrayToBlockByCol(Array const &m, Block< Type > &block, int iRow, int jCol)
default dimensions
static void arrayToBlock(Array const &m, Block< Type > &block, int iRow, int jCol)
copy a part of an Array in a Block
static void arrayToPanelByCol(Array const &m, Panel< Type > &panel, int iRow, int kPos)
default dimensions
This structure regroup the methods to used after block multiplication in order to perform the product...
static void mult2Outer(Lhs const &lhs, Rhs const &rhs, Result &res, int k)
multiplication with two outer rows/columns
static void mult1Outer(Lhs const &lhs, Rhs const &rhs, Result &res, int k)
multiplication with one outer rows/columns
static void mult3Outer(Lhs const &lhs, Rhs const &rhs, Result &res, int k)
multiplication with three outer rows/columns
this structure regroup all the methods using only pointers on the Type
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)
Main method for Matrices multiplication implementation.
static void multPanelByBlockPart(SubLhs const &lhs, SubRhs const &rhs, Result &res)
Default dimension.
hidden::MultCoefImpl< Lhs, Rhs, Result > MultCoeff
static void multPanelByBlock(SubLhs const &lhs, SubRhs const &rhs, Result &res)
Default dimension.
hidden::MultImpl< Type > Cmult
Methods to use for C=AB with A divided in panels and B divided in blocks.
static void multPanelByBlock(Panel< Type > const &panel, Block< Type > const &block, Result &res, int iRow, int jCol, int pSize, int bSize)
with panel size and block size dimension given
hidden::MultImpl< Type > Cmult
static void run(Lhs const &lhs, Rhs const &rhs, Result &res)
Main method for Matrices multiplication implementation.
hidden::MultCoefImpl< Lhs, Rhs, Result > MultCoeff
hidden::CopySubArrayImpl< Lhs, Type > CopyLhsImpl
static void multPanelByBlock(Panel< Type > const &panel, Block< Type > const &block, Result &res, int iRow, int jCol, int pSize)
hidden::CopySubArrayImpl< Rhs, Type > CopyRhsImpl
static void multPanelByBlock(Panel< Type > const &panel, Block< Type > const &block, Result &res, int iRow, int jCol)
Default dimension.