45 namespace Test_Eigensolver {
46 const std::string
test_name =
"Eigensolver.Solve_Chebyshev";
50 const std::string filename_input =
"test_Eigensolver_Chebyshev.yaml";
51 const std::string filename_output =
"stdout";
53 class Parameters_Test_Eigensolver :
public Parameters {
55 Parameters_Test_Eigensolver()
57 Register_string(
"gauge_config_status",
"NULL");
58 Register_string(
"gauge_config_type_input",
"NULL");
59 Register_string(
"config_filename_input",
"NULL");
61 Register_string(
"verbose_level",
"NULL");
63 Register_double(
"expected_result", 0.0);
71 #ifdef USE_TESTMANAGER_AUTOREGISTER
73 #if defined(USE_GROUP_SU2)
92 Parameters *params_test =
new Parameters_Test_Eigensolver;
110 params_manager.
read_params(filename_input, params_all);
112 const string str_gconf_status = params_test->
get_string(
"gauge_config_status");
113 const string str_gconf_read = params_test->
get_string(
"gauge_config_type_input");
114 const string readfile = params_test->
get_string(
"config_filename_input");
115 const string str_vlevel = params_test->
get_string(
"verbose_level");
117 const bool do_check = params_test->
is_set(
"expected_result");
118 const double expected_result = do_check ? params_test->
get_double(
"expected_result") : 0.0;
120 const string str_gmset_type = params_clover->
get_string(
"gamma_matrix_type");
121 const string str_proj_type = params_proj->
get_string(
"projection_type");
122 const string str_smear_type = params_smear->
get_string(
"smear_type");
123 const string str_sortfield_type = params_irlanczos->
get_string(
"eigensolver_mode");
124 const int Nk = params_irlanczos->
get_int(
"number_of_wanted_eigenvectors");
125 const int Np = params_irlanczos->
get_int(
"number_of_working_eigenvectors");
126 const int Niter_eigen = params_irlanczos->
get_int(
"maximum_number_of_iteration");
127 const double Enorm_eigen = params_irlanczos->
get_double(
"convergence_criterion_squared");
128 const double Vthreshold = params_irlanczos->
get_double(
"threshold_value");
133 vout.
general(vl,
" gconf_status = %s\n", str_gconf_status.c_str());
134 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
135 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
136 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
137 vout.
general(vl,
" gmset_type = %s\n", str_gmset_type.c_str());
138 vout.
general(vl,
" proj_type = %s\n", str_proj_type.c_str());
139 vout.
general(vl,
" smear_type = %s\n", str_smear_type.c_str());
140 vout.
general(vl,
" sortfield_type = %s\n", str_sortfield_type.c_str());
157 if (str_gconf_status ==
"Continue") {
159 }
else if (str_gconf_status ==
"Cold_start") {
161 }
else if (str_gconf_status ==
"Hot_start") {
165 vout.
crucial(vl,
"%s: unsupported gconf status \"%s\".\n",
test_name.c_str(), str_gconf_status.c_str());
169 Projection *proj = Projection::New(str_proj_type);
170 Smear *smear = Smear::New(str_smear_type, proj);
182 Fopr *fopr = fopr_smear;
188 double Vthreshold_ch = fopr_ch->
mult(Vthreshold * Vthreshold);
189 vout.
general(vl,
"Vthreshold_ch = %12.6f\n", Vthreshold_ch);
192 SortField *sort = SortField::New(str_sortfield_type);
195 eigen->
set_parameters(Nk, Np, Niter_eigen, Enorm_eigen, Vthreshold_ch);
204 valarray<double> TDa(Nm);
205 valarray<Field> vk(Nm);
209 int NFvol = b2.
nvol();
211 for (
int k = 0; k < Nm; ++k) {
212 vk[k].reset(NFin, NFvol, NFex);
217 eigen->
solve(TDa, vk, Nsbt, Nconv, (
Field)b2);
223 v.
reset(NFin, NFvol, NFex);
228 for (
int i = 0; i < Nsbt + 1; ++i) {
229 v = fopr->
mult(vk[i]);
231 double vnum = vk[i] * v;
232 double vden = vk[i] * vk[i];
233 double veig = vnum / vden;
240 vout.
general(vl,
"Eigenvalues: %4d %20.14f %10.4e %10.4e\n", i, TDa[i], vv, vden - 1.0);
243 double result = TDa[0];
250 delete params_clover;
251 delete params_chebyshev;
254 delete params_dr_smear;
255 delete params_irlanczos;
279 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
Random number generator base on M-series.
Eigenvalue solver with Implicitly Restarted Lanczos algorithm.
void read_params(const std::string ¶ms_file, Parameters *params)
read parameters from file.
void detailed(const char *format,...)
const Field mult(const Field &f)
multiplies fermion operator to a given field and returns the resultant field.
virtual const Field mult(const Field &)=0
multiplies fermion operator to a given field and returns the resultant field.
void general(const char *format,...)
const std::string test_name
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
Container of Field-type object.
virtual void set_parameters(const Parameters &)=0
int get_int(const string &key) const
static Parameters * New(const std::string &realm)
void set_random(RandomNumbers *rand)
Wilson-type fermion field.
smeared fermion operator.
static bool RegisterTest(const std::string &key, const Test_function func)
void set_parameters(const Parameters ¶ms)
bool is_set(const string &) const
double get_double(const string &key) const
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
int solve_chebyshev(void)
int non_NULL(const std::string v)
void crucial(const char *format,...)
void Register_Parameters(const string &, Parameters *const)
base class for projection operator into gauge group.
void solve(std::valarray< double > &TDa, std::valarray< Field > &vk, int &Nsbt, int &Nconv, const Field &b)
Manager of smeared configurations.
void set_parameters(const Parameters ¶ms)
void set_parameters(const Parameters ¶ms)
set paramters, must be called before set_config
virtual void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Base class for sorting pair instances (value,field).
base class for smearing of link variables.
Parameter manager with YAML parser.
GaugeConfig class for file I/O of gauge configuration.
Base class of fermion operator family.
int verify(const double expected, const double result)
void read_file(Field *u, const string &filename)
string get_string(const string &key) const
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
static VerboseLevel set_verbose_level(const std::string &str)
void set_parameters(const Parameters ¶ms)