Exemplo n.º 1
0
typename MAT::type
det_rat_row_column_up(int flavor_ins, int flavor_rem, double t_ins, double t_rem, int row, int column, const MAT & M,
  const operator_container_t& creation_operators, const operator_container_t& annihilation_operators, const HYB& F, MAT2& sign_Fs, MAT2& Fe_M, double BETA) {

  typedef typename MAT::type SCALAR;
  
  const double sign=((row+column)%2==0 ? 1 : -1);
  
  if (annihilation_operators.size()>0) {
    operator_container_t::iterator it_c=creation_operators.begin();
    operator_container_t::iterator it_a=annihilation_operators.begin();
    Eigen::Matrix<SCALAR,Eigen::Dynamic,Eigen::Dynamic> Fe(1,annihilation_operators.size());
    if (annihilation_operators.size()!=creation_operators.size()) {
      throw std::runtime_error("annihilation_operators.size()!=creation_operators.size() in det_rat_row_column_up");
    }

    for (int i=0; i<(int)creation_operators.size(); i++) {
      Fe(0,i) = interpolate_F(t_rem-it_c->time(), BETA, F[flavor_rem][it_c->flavor()]);
      sign_Fs(i,0) = sign*interpolate_F(it_a->time()-t_ins, BETA, F[(int)(it_a->flavor())][flavor_ins]);
      it_c++;
      it_a++;
    }
    
    Fe_M = Fe*M.block();
  
    return sign*interpolate_F(t_rem-t_ins, BETA, F[flavor_rem][flavor_ins])-(Fe_M*sign_Fs)(0,0);
  } else {
    return sign*interpolate_F(t_rem-t_ins, BETA, F[flavor_rem][flavor_ins]);
  }
}
Exemplo n.º 2
0
int compute_M_shift_end(double new_t_end, int k, int new_position, int flavor_rem, MAT & M,
 const operator_container_t & creation_operators, const HYB & F,
 double BETA, SCALAR det_rat) {

  std::vector<SCALAR> R(M.size1(), 0), M_k(M.size1(), 0), Fe(M.size1(), 0);

  operator_container_t::const_iterator itc = creation_operators.begin();
  for (int i = 0; i < (int) M_k.size(); i++) {
    M_k[i] = M(i, k);
    Fe[i] = interpolate_F(new_t_end - itc->time(), BETA, F[flavor_rem][itc->flavor()]);
    itc++;
  }
  for (int i = 0; i < (int) R.size(); i++) {
    if (i != k) {
      for (int j = 0; j < (int) R.size(); j++)
        R[i] += Fe[j] * M(j, i);
    }
  }
  for (int m = 0; m < (int) M.size1(); m++) {
    if (m != k) {
      for (int n = 0; n < (int) M.size1(); n++) {
        M(n, m) -= M_k[n] * R[m] / det_rat;
      }
    } else {
      for (int n = 0; n < (int) M.size1(); n++) {
        M(n, m) = M_k[n] / det_rat;
      }
    }
  }

  //swap column
  move_column(M, k, new_position);

  return std::abs(k-new_position);
}  
Exemplo n.º 3
0
SCALAR det_rat_shift_end(double new_t_end, int k, int flavor_rem, MAT & M,
 const operator_container_t & creation_operators, const HYB & F, double BETA) {

  SCALAR det_rat = 0;
  operator_container_t::const_iterator itc = creation_operators.begin();
  for (int i = 0; i < M.size1(); i++) {
    det_rat += interpolate_F(new_t_end - itc->time(), BETA, F[flavor_rem][itc->flavor()]) * M(i, k);
    itc++;
  }
  return det_rat;
}
Exemplo n.º 4
0
SCALAR det_rat_shift_start(double new_t_start, int k, int flavor_ins,
 MAT & M, operator_container_t & annihilation_operators, const HYB & F, double BETA) {

  SCALAR det_rat = 0;
  operator_container_t::iterator ita = annihilation_operators.begin();
  for (int i = 0; i < M.size1(); i++) {
    det_rat += interpolate_F(ita->time() - new_t_start, BETA, F[ita->flavor()][flavor_ins]) * M(k, i);//right
    ita++;
  }

  return det_rat;
}
Exemplo n.º 5
0
void construct_blas_matrix(MAT & M, const operator_container_t &creation_operators,
  const operator_container_t &annihilation_operators, double BETA, const HYB & F)
{

  int N = creation_operators.size();
  M.resize(N, N);
  int row = -1;
  int column = -1;
  for (operator_container_t::iterator ita = annihilation_operators.begin(); ita != annihilation_operators.end(); ita++) {
    row++;
    for (operator_container_t::iterator itc = creation_operators.begin(); itc != creation_operators.end(); itc++) {
      column++;

      double argument = ita->time() - itc->time();
      double sign = 1;
      if (argument < 0) {
        argument += BETA;
        sign = -1;
      }
      M(row, column) = interpolate_F(argument, BETA, F[ita->flavor()][itc->flavor()]) * sign;
    }
    column = -1;
  }
}
Exemplo n.º 6
0
inline
double make_set_impl(const operator_container_t &annihilation_operators, double BETA, double dtau, std::set<boost::tuple<double,int,double> >& annset) {
  int row = -1;
  annset.clear();
  int num_op_shifted = 0;
  double perm = 1.0;
  for (operator_container_t::iterator ita = annihilation_operators.begin(); ita != annihilation_operators.end(); ita++) {
    row++;
    double p = 1.0;
    double t = ita->time() + dtau;
    if (t > BETA) {
      t -= BETA;
      p = -1.0;
      perm *= -1;
      ++num_op_shifted;
    }
    annset.insert(boost::make_tuple(t,row,p));
  }
  return perm * (
                 ((annihilation_operators.size()-num_op_shifted)*num_op_shifted)%2==0 ? 1 : -1
  );
}
Exemplo n.º 7
0
int compute_M_shift_start(double new_t_start, int k, int new_position, int flavor_ins,
        MAT & M, const operator_container_t & annihilation_operators, const HYB & F, double BETA, SCALAR det_rat) {

  std::vector<SCALAR> R(M.size1(), 0), M_k(M.size1(), 0), Fs(M.size1(), 0);

  operator_container_t::const_iterator ita = annihilation_operators.begin();
  for (int i = 0; i < (int) M_k.size(); i++) {
    M_k[i] = M(k, i);
    Fs[i] = interpolate_F(ita->time() - new_t_start, BETA, F[ita->flavor()][flavor_ins]);
    ita++;
  }

  for (int i = 0; i < (int) R.size(); i++) {
    if (i != k) {
      for (int j = 0; j < (int) R.size(); j++)
        R[i] += M(i, j) * Fs[j];
    }
  }

  for (int n = 0; n < (int) M.size1(); n++) {
    if (n != k) {
      for (int m = 0; m < (int) M.size1(); m++) {
        M(n, m) -= M_k[m] * R[n] / det_rat;
      }
    } else {
      for (int m = 0; m < (int) M.size1(); m++) {
        M(n, m) = M_k[m] / det_rat;
      }
    }
  }

  //swap rows
  move_row(M, k, new_position);

  return std::abs(k-new_position);
}