本文整理汇总了C++中BlockVector::tabIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockVector::tabIndex方法的具体用法?C++ BlockVector::tabIndex怎么用?C++ BlockVector::tabIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockVector
的用法示例。
在下文中一共展示了BlockVector::tabIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: subprod
void subprod(const SiconosMatrix& A, const BlockVector& x, SiconosVector& y, const Index& coord, bool init)
{
assert(!(A.isPLUFactorized()) && "A is PLUFactorized in prod !!");
// Number of the subvector of x that handles element at position coord[4]
std::size_t firstBlockNum = x.getNumVectorAtPos(coord[4]);
// Number of the subvector of x that handles element at position coord[5]
unsigned int lastBlockNum = x.getNumVectorAtPos(coord[5]);
Index subCoord = coord;
SPC::SiconosVector tmp = x[firstBlockNum];
std::size_t subSize = tmp->size(); // Size of the sub-vector
const SP::Index xTab = x.tabIndex();
if (firstBlockNum != 0)
{
subCoord[4] -= (*xTab)[firstBlockNum - 1];
subCoord[5] = std::min(coord[5] - (*xTab)[firstBlockNum - 1], subSize);
}
else
subCoord[5] = std::min(coord[5], subSize);
if (firstBlockNum == lastBlockNum)
{
subprod(A, *tmp, y, subCoord, init);
}
else
{
unsigned int xPos = 0 ; // Position in x of the current sub-vector of x
bool firstLoop = true;
subCoord[3] = coord[2] + subCoord[5] - subCoord[4];
for (VectorOfVectors::const_iterator it = x.begin(); it != x.end(); ++it)
{
if ((*it)->getNum() == 0)
SiconosMatrixException::selfThrow("subprod(A,x,y) error: not yet implemented for x block of blocks ...");
if (xPos >= firstBlockNum && xPos <= lastBlockNum)
{
tmp = x[xPos];
if (firstLoop)
{
subprod(A, *tmp, y, subCoord, init);
firstLoop = false;
}
else
{
subCoord[2] += subCoord[5] - subCoord[4]; // !! old values for 4 and 5
subSize = tmp->size();
subCoord[4] = 0;
subCoord[5] = std::min(coord[5] - (*xTab)[xPos - 1], subSize);
subCoord[3] = subCoord[2] + subCoord[5] - subCoord[4];
subprod(A, *tmp, y, subCoord, false);
}
}
xPos++;
}
}
}