示例#1
0
文件: driver.C 项目: naokin/mpsxx
void prototype::ComputeSigmaVectorConj // compute: < psi | H  ... but returned as ket state | sgv >
(              const btas::QSDArray<4>& mpo0,
               const btas::QSDArray<3>& lopr,
               const btas::QSDArray<3>& ropr,
               const btas::QSDArray<3>& wfn0,
                     btas::QSDArray<3>& sgv0)
{
  sgv0.conjugateSelf();
  btas::QSDArray<4> scr1;
  btas::QSDcontract(1.0, lopr, shape(0), wfn0.conjugate(), shape(0), 1.0, scr1);
  btas::QSDArray<4> scr2;
  btas::QSDcontract(1.0, scr1, shape(0, 2), mpo0, shape(0, 1), 1.0, scr2);
  btas::QSDcontract(1.0, scr2, shape(1, 3), ropr, shape(0, 1), 1.0, sgv0);
  sgv0.conjugateSelf();
}
示例#2
0
文件: driver.C 项目: naokin/mpsxx
void prototype::Renormalize
(bool forward, const btas::QSDArray<4>& mpo0,
               const btas::QSDArray<3>& opr0,
               const btas::QSDArray<3>& bra0,
               const btas::QSDArray<3>& ket0,
                     btas::QSDArray<3>& opr1)
{
  if(forward) {
    btas::QSDArray<4> scr1;
    btas::QSDcontract(1.0, opr0, shape(0), bra0.conjugate(), shape(0), 1.0, scr1);
    btas::QSDArray<4> scr2;
    btas::QSDcontract(1.0, scr1, shape(0, 2), mpo0, shape(0, 1), 1.0, scr2);
    btas::QSDcontract(1.0, scr2, shape(0, 2), ket0, shape(0, 1), 1.0, opr1);
  }
  else {
    btas::QSDArray<4> scr1;
    btas::QSDcontract(1.0, bra0.conjugate(), shape(2), opr0, shape(0), 1.0, scr1);
    btas::QSDArray<4> scr2;
    btas::QSDcontract(1.0, scr1, shape(1, 2), mpo0, shape(1, 3), 1.0, scr2);
    btas::QSDcontract(1.0, scr2, shape(3, 1), ket0, shape(1, 2), 1.0, opr1);
  }
}
示例#3
0
文件: driver.C 项目: yingjerkao/btas
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);
  }
}
示例#4
0
文件: driver.C 项目: naokin/mpsxx
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);
}
示例#5
0
文件: driver.C 项目: naokin/mpsxx
void prototype::AnalyzeTransferOperator
(              const btas::QSDArray<3>& bra,
               const btas::QSDArray<3>& ket)
{
  btas::QSDArray<4> escr;
  btas::QSDcontract(1.0, bra.conjugate(), shape(1), ket, shape(1), 1.0, escr);
  btas::QSDArray<4> eopr;
  btas::QSDpermute(escr, shape(0,2,1,3), eopr);
  btas::DiagonalQSDArray<1> sval;
  btas::QSDArray<3> lvec;
  btas::QSDArray<3> rvec;
  btas::QSDgesvd(btas::LeftCanonical, eopr, sval, lvec, rvec, 0);
  cout << "\t----------------------------------------------------------------------------------------------------" << endl;
  cout << "\ttransfer operator :: ";
  cout << setprecision(8) << fixed << eopr << endl;
  cout << "\t----------------------------------------------------------------------------------------------------" << endl;
  cout << "\tsingular values   :: ";
  cout << setprecision(8) << fixed << sval << endl;
  cout << "\t----------------------------------------------------------------------------------------------------" << endl;
}