41 const std::string
test_name =
"Eigensolver.Chebyshev";
45 const std::string filename_input =
"test_Eigensolver_Chebyshev.yaml";
51 #ifdef USE_TESTMANAGER_AUTOREGISTER
53 #if defined(USE_GROUP_SU2)
80 const Parameters params_irlanczos = params_all.
lookup(
"Eigensolver_Chebyshev");
82 const string str_gconf_status = params_test.
get_string(
"gauge_config_status");
83 const string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
84 const string readfile = params_test.
get_string(
"config_filename_input");
85 const string str_rand_type = params_test.
get_string(
"random_number_type");
86 const unsigned long seed = params_test.
get_unsigned_long(
"seed_for_random_number");
87 const string str_vlevel = params_test.
get_string(
"verbose_level");
89 const bool do_check = params_test.
is_set(
"expected_result");
90 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
92 const string str_fopr_type = params_fopr.
get_string(
"fermion_type");
93 const string str_gmset_type = params_fopr.
get_string(
"gamma_matrix_type");
94 const string str_proj_type = params_proj.
get_string(
"projection_type");
95 const string str_smear_type = params_smear.
get_string(
"smear_type");
96 const int Nsmear = params_dr_smear.
get_int(
"number_of_smearing");
97 const string str_sortfield_type = params_irlanczos.
get_string(
"eigensolver_mode");
98 const int Nk = params_irlanczos.
get_int(
"number_of_wanted_eigenvectors");
99 const int Np = params_irlanczos.
get_int(
"number_of_working_eigenvectors");
100 const int Niter_eigen = params_irlanczos.
get_int(
"maximum_number_of_iteration");
101 const double Enorm_eigen = params_irlanczos.
get_double(
"convergence_criterion_squared");
102 const double Vthreshold = params_irlanczos.
get_double(
"threshold_value");
107 vout.
general(
vl,
" gconf_status = %s\n", str_gconf_status.c_str());
108 vout.
general(
vl,
" gconf_read = %s\n", str_gconf_read.c_str());
110 vout.
general(
vl,
" rand_type = %s\n", str_rand_type.c_str());
113 vout.
general(
vl,
" gmset_type = %s\n", str_gmset_type.c_str());
114 vout.
general(
vl,
" proj_type = %s\n", str_proj_type.c_str());
115 vout.
general(
vl,
" smear_type = %s\n", str_smear_type.c_str());
116 vout.
general(
vl,
" sortfield_type = %s\n", str_sortfield_type.c_str());
128 if ((Nsmear > 0) && (str_proj_type ==
"Stout_SU3")) {
142 if (str_gconf_status ==
"Continue") {
144 }
else if (str_gconf_status ==
"Cold_start") {
146 }
else if (str_gconf_status ==
"Hot_start") {
149 vout.
crucial(
vl,
"Error at %s: unsupported gconf status \"%s\"\n",
test_name.c_str(), str_gconf_status.c_str());
154 unique_ptr<Projection> proj(Projection::New(str_proj_type, params_all.
lookup(
"Projection")));
155 unique_ptr<Smear> smear(Smear::New(str_smear_type, proj.get(), params_all.
lookup(
"Smear")));
156 unique_ptr<Director_Smear> dr_smear(
new Director_Smear(smear.get(), params_all.
lookup(
"Director_Smear")));
157 dr_smear->set_config(&U);
159 const Field_G *Usmear = (
Field_G *)dr_smear->getptr_smearedConfig(Nsmear);
165 unique_ptr<Fopr> fopr(Fopr::New(str_fopr_type, params_fopr));
166 fopr->set_config(&U);
167 fopr->set_mode(
"DdagD");
169 unique_ptr<Fopr_Chebyshev> fopr_ch(
new Fopr_Chebyshev(fopr.get(), params_chebyshev));
171 const double Vthreshold_ch = fopr_ch->mult(Vthreshold * Vthreshold);
178 eigen->set_parameters(str_sortfield_type, Nk, Np,
179 Niter_eigen, Enorm_eigen, Vthreshold_ch);
188 const int NFin = b2.
nin();
189 const int NFvol = b2.
nvol();
190 const int NFex = b2.
nex();
192 const int Nm = Nk + Np;
193 std::vector<double> TDa(Nm);
195 std::vector<Field> vk(Nm);
196 for (
int k = 0; k < Nm; ++k) {
197 vk[k].reset(NFin, NFvol, NFex);
202 eigen->solve(TDa, vk, Nsbt, Nconv, (
Field)b2);
207 for (
int i = 0; i < Nsbt + 1; ++i) {
208 Field v(NFin, NFvol, NFex);
211 fopr->mult(v, vk[i]);
213 double vnum =
dot(vk[i], v);
214 double vden =
dot(vk[i], vk[i]);
215 double veig = vnum / vden;
218 axpy(v, -TDa[i], vk[i]);
219 double vv = v.
norm2();
221 vout.
general(
vl,
"Eigenvalues: %4d %20.14f %10.4e %10.4e\n", i, TDa[i], vv, vden - 1.0);
224 const double result = TDa[0];