Ejemplo n.º 1
0
void prototype::ComputeGuess
(bool forward, const btas::QSDArray<3>& mps0,
               const btas::QSDArray<3>& wfn0,
               const btas::QSDArray<3>& mps1,
                     btas::QSDArray<3>& wfn1)
{
  using btas::NoTrans;
  using btas::ConjTrans;

  if(forward) {
    btas::QSDArray<2> lres;
    btas::QSDgemm(ConjTrans, NoTrans, 1.0, mps0, wfn0, 1.0, lres);
    wfn1.clear();
    btas::QSDgemm(  NoTrans, NoTrans, 1.0, lres, mps1, 1.0, wfn1);
  }
  else {
    btas::QSDArray<2> rres;
    btas::QSDgemm(NoTrans, ConjTrans, 1.0, wfn0, mps0, 1.0, rres);
    wfn1.clear();
    btas::QSDgemm(NoTrans,   NoTrans, 1.0, mps1, rres, 1.0, wfn1);
  }
}
Ejemplo n.º 2
0
void prototype::ComputeInverseGauge
(              const btas::QSDArray<2>& gauge_0,
                     btas::QSDArray<2>& gauge_i)
{
  btas::DiagonalQSDArray<1> s;
  btas::QSDArray<2> u;
  btas::QSDArray<2> v;
  btas::QSDgesvd(btas::LeftCanonical, gauge_0, s, u, v, 0);
  for(btas::DiagonalQSDArray<1>::iterator it = s.begin(); it != s.end(); ++it) {
    for(btas::DArray<1>::iterator id = it->second->begin(); id != it->second->end(); ++id) {
      if(fabs(*id) >= 1.0e-20)
        *id = 1.0/(*id);
      else
        *id = 0.0;
    }
  }
  btas::SDdimd(u, s);
  gauge_i.clear();
  btas::QSDgemm(btas::ConjTrans, btas::ConjTrans, 1.0, v, u, 1.0, gauge_i);
}