Пример #1
0
void LUIncPreconditioner::solveMxb(Vector &x, const Vector &b) const
{
#ifdef DEBUG
    assert(x.getLength() == b.getLength() );
#endif
    Vector y( b.getLength() ); // TEMPORARY VECTOR
    forwardSubstitution(y,b);
    backwardSubstitution(x,y);
}
static Vec<double> lsSolve(const Mat<double> &L, const Mat<double> &U,
                           const Vec<double> &b)
{
  Vec<double> x(L.ys());
  // Solve Ly=b, Here y=x
  forwardSubstitution(L, b, x);
  // Solve Ux=y, Here x=y
  backwardSubstitution(U, x, x);
  return x;
}