// x block, y siconos void private_prod(const SiconosMatrix& A, unsigned int startRow, const SiconosVector& x, SiconosVector& y, bool init) { assert(!(A.isPLUFactorized()) && "A is PLUFactorized in prod !!"); // Computes y = subA *x (or += if init = false), subA being a sub-matrix of A, between el. of index (row) startRow and startRow + sizeY if (init) // y = subA * x , else y += subA * x y.zero(); private_addprod(A, startRow, 0, x, y); }
void FirstOrderLinearR::computeh(double time, BlockVector& x, SiconosVector& lambda, SiconosVector& z, SiconosVector& y) { y.zero(); if (_pluginJachx->fPtr) { if (!_C) _C.reset(new SimpleMatrix(y.size(),x.size())); computeC(time, z, *_C); } if (_pluginJachlambda->fPtr) { if (!_D) _D.reset(new SimpleMatrix(y.size(),lambda.size())); computeD(time, z, *_D); } if (_pluginf->fPtr) { if (!_F) _F.reset(new SimpleMatrix(y.size(),z.size())); computeF(time, z, *_F); } if (_plugine->fPtr) { if (!_e) _e.reset(new SiconosVector(y.size())); computee(time, z, *_e); } if (_C) prod(*_C, x, y, false); if (_D) prod(*_D, lambda, y, false); if (_e) y += *_e; if (_F) prod(*_F, z, y, false); }
void FirstOrderLinearR::computeh(double time, VectorOfVectors& workV, VectorOfSMatrices& workM, BlockVector& x, SiconosVector& lambda, SiconosVector& z, SiconosVector& y) { y.zero(); if (_pluginJachx->fPtr) { SimpleMatrix& C = *workM[FirstOrderR::mat_C]; computeC(time, z, C); prod(C, x, y, false); } if (_pluginJachlambda->fPtr) { SimpleMatrix& D = *workM[FirstOrderR::mat_D]; computeD(time, z, D); prod(D, lambda, y, false); } if (_pluginf->fPtr) { SimpleMatrix& F = *workM[FirstOrderR::mat_F]; computeF(time, z, F); prod(F, z, y, false); } if (_plugine->fPtr) { SiconosVector& e = *workV[FirstOrderR::e]; computee(time, z, e); y+= e; } if (_C) prod(*_C, x, y, false); if (_D) prod(*_D, lambda, y, false); if (_e) y += *_e; if (_F) prod(*_F, z, y, false); }
void prod(const SiconosMatrix& A, const BlockVector& x, SiconosVector& y, bool init) { assert(!(A.isPLUFactorized()) && "A is PLUFactorized in prod !!"); if (init) y.zero(); unsigned int startRow = 0; unsigned int startCol = 0; // In private_addprod, the sum of all blocks of x, x[i], is computed: y = Sum_i (subA x[i]), with subA a submatrix of A, // starting from position startRow in rows and startCol in columns. // private_prod takes also into account the fact that each block of x can also be a block. VectorOfVectors::const_iterator it; for (it = x.begin(); it != x.end(); ++it) { private_addprod(A, startRow, startCol, **it, y); startCol += (*it)->size(); } }