コード例 #1
0
ファイル: BasicOperator.cpp プロジェクト: chelmes/Contraction
void BasicOperator::mult_dirac(const Eigen::MatrixXcd& matrix,
                               Eigen::MatrixXcd& reordered, 
                               const size_t index) const {

  const vec_pdg_Corr op_Corr = global_data->get_lookup_corr();

  const size_t rows = matrix.rows();
  const size_t cols = matrix.cols();
  const size_t col = cols/4;
  if( (rows != reordered.rows()) || (cols != reordered.cols()) ){
    std::cout << "Error! In BasicOperator::mult_dirac: size of matrix and "
                 "reordered must be equal" << std::endl;
    exit(0);
  }

  for(const auto& dirac : op_Corr[index].gamma){
    if(dirac != 4){
      for(size_t block = 0; block < 4; block++){
        reordered.block(0, block * col, rows, col) = 
          gamma[dirac].value[block] *
          matrix.block(0, gamma[dirac].row[block]*col, rows, col);
      }
    }
  }

}
コード例 #2
0
//fix phase of eigensystem and store phase of first entry of each eigenvector
void fix_phase(Eigen::MatrixXcd& V, Eigen::MatrixXcd& V_fix, std::vector<double>& phase) {
   const int V3 = pars -> get_int("V3");
  //helper variables:
  //Number of eigenvectors
  int n_ev;
  //negative imaginary
  std::complex<double> i_neg (0,-1);
  //tmp factor and phase
  std::complex<double> fac (1.,1.);
  double tmp_phase = 0;
  //get sizes right, resize if necessary
  n_ev = V.cols();
  if (phase.size() != n_ev) phase.resize(n_ev);
  if (V_fix.cols() != n_ev) V_fix.resize(3*V3,n_ev);
  //loop over all eigenvectors of system
  for (int n = 0; n < n_ev; ++n) {

    tmp_phase = std::arg(V(0,n));
    phase.at(n) = tmp_phase;
    fac = std::exp(i_neg*tmp_phase);
    //Fix phase of eigenvector with negative polar angle of first entry
    V_fix.col(n) = fac * V.col(n); 

  }
}
コード例 #3
0
ファイル: main.cpp プロジェクト: andyras/propellor
int main(int argc, char ** argv) {
  // initialize parameters /////////////////////////////////////////////////////
  Parameters p;

#ifdef DEBUG
  cout << "Memory usage of p: " << sizeof(p) << " bytes." << endl;

  Eigen::MatrixXcd H = p.Ham();

  cout << "size of Hamiltonian: " << H.rows() << "x" << H.cols() << endl;
  cout << "Hamiltonian: " << H << endl;
  cout << "Second element of Hamiltonian: " << p.Ham(0,1) << endl;
#endif

  // propagate /////////////////////////////////////////////////////////////////

  return 0;
}
コード例 #4
0
ファイル: GaugeField.cpp プロジェクト: maowerner/cntr.v0.1
// TODO: work on interface with eigenvector class
// transform matrix of eigenvectors with gauge array
Eigen::MatrixXcd GaugeField::trafo_ev(const Eigen::MatrixXcd &eig_sys) {
  const ssize_t dim_row = eig_sys.rows();
  const ssize_t dim_col = eig_sys.cols();
  Eigen::MatrixXcd ret(dim_row, dim_col);
  if (omega.shape()[0] == 0)
    build_gauge_array(1);
  // write_gauge_matrices("ev_trafo_log.bin",Omega);

  for (ssize_t nev = 0; nev < dim_col; ++nev) {
    for (ssize_t vol = 0; vol < dim_row; ++vol) {
      int ind_c = vol % 3;
      Eigen::Vector3cd tmp =
          omega[0][ind_c].adjoint() * (eig_sys.col(nev)).segment(ind_c, 3);
      (ret.col(nev)).segment(ind_c, 3) = tmp;
    }  // end loop nev
  }    // end loop vol
  return ret;
}
コード例 #5
0
ファイル: symmolint.hpp プロジェクト: ReiMatsuzaki/l2func
 inline int size_pn() const { return coef_iat_ipn.cols(); }