inline void L1BackSubstitute(const MatrixTemplate<T>& a, const MatrixTemplate<T>& b, MatrixTemplate<T>& x)
{
  if(x.isEmpty()) 
    x.resize(a.n,b.n);
  else Assert(x.m == a.n && x.n == b.n);
  for(int i=0;i<x.n;i++) {
    VectorTemplate<T> xi,bi;
    x.getColRef(i,xi);
    b.getColRef(i,bi);
    L1BackSubstitute(a,bi,xi);
  }
}
Beispiel #2
0
bool LDLDecomposition<T>::backSub(const MatrixT& B, MatrixT& X) const
{
  X.resize(B.m,B.n);
  MatrixT temp(B.m,B.n);
  L1BackSubstitute(LDL,B,temp);
  VectorT tempi;
  bool res=true;
  for(int i=0;i<temp.n;i++) {
    temp.getColRef(i,tempi);
    if(!DBackSub(tempi,tempi)) res=false;
  }
  Lt1BackSubstitute(LDL,temp,X);
  return res;
}
Beispiel #3
0
void LDLDecomposition<T>::LBackSub(const VectorT& b, VectorT& x) const
{
  Assert(b.n == LDL.n);
  x.resize(LDL.n);
  L1BackSubstitute(LDL,b,x);
}