示例#1
0
double SQuIDS::GetExpectationValueD(const SU_vector& op, unsigned int nrh, double xi,
                                    SQuIDS::expectationValueDBuffer& buf) const{
  //find bracketing state entries
  auto xit=std::lower_bound(x.begin(),x.end(),xi);
  if(xit==x.end())
    throw std::runtime_error("SQUIDS::GetExpectationValueD : x value not in the array.");
  if(xit!=x.begin())
    xit--;
  size_t xid=std::distance(x.begin(),xit);

  //linearly interpolate between the two states
  double f2=((xi-x[xid])/(x[xid+1]-x[xid]));
  double f1=1-f2;
  buf.state =f1*state[xid].rho[nrh];
  buf.state+=f2*state[xid+1].rho[nrh];
  //compute the evolved operator
  buf.op=op.Evolve(H0(xi,nrh),t-t_ini);
  //apply operator to state
  return buf.state*buf.op;
}
示例#2
0
double SQuIDS::GetExpectationValueD(const SU_vector& op, unsigned int nrh, double xi,
                                    SQuIDS::expectationValueDBuffer& buf,
                                    double scale, std::vector<bool>& avr) const{
  //find bracketing state entries
  auto xit=std::lower_bound(x.begin(),x.end(),xi);
  if(xit==x.end())
    throw std::runtime_error("SQUIDS::GetExpectationValueD : x value not in the array.");
  if(xit!=x.begin())
    xit--;
  size_t xid=std::distance(x.begin(),xit);

  //linearly interpolate between the two states
  double f2=((xi-x[xid])/(x[xid+1]-x[xid]));
  double f1=1-f2;
  buf.state =f1*state[xid].rho[nrh];
  buf.state+=f2*state[xid+1].rho[nrh];
  //compute the evolved operator
  std::unique_ptr<double[]> evol_buf(new double[H0(xi,nrh).GetEvolveBufferSize()]);
  H0(xi,nrh).PrepareEvolve(evol_buf.get(),t-t_ini,scale,avr);
  buf.op=op.Evolve(evol_buf.get());
  //apply operator to state
  return (buf.op*state[xid].rho[nrh])*f1 + (buf.op*state[xid+1].rho[nrh])*f2;
  //return buf.state*buf.op;
}
示例#3
0
double SQuIDS::GetExpectationValue(SU_vector op, unsigned int nrh, unsigned int i, double scale, std::vector<bool>& avr) const {
  SU_vector h0=H0(x[i],nrh);
  std::unique_ptr<double[]> evol_buf(new double[h0.GetEvolveBufferSize()]);
  h0.PrepareEvolve(evol_buf.get(),t-t_ini,scale,avr);
  return state[i].rho[nrh]*op.Evolve(evol_buf.get());
}
示例#4
0
double SQuIDS::GetExpectationValue(SU_vector op, unsigned int nrh, unsigned int i) const{
  SU_vector h0=H0(x[i],nrh);
  return state[i].rho[nrh]*op.Evolve(h0,t-t_ini);
}