48 const std::string filename_input =
"test_Spectrum_CRSMatrix_Clover_Lexical.yaml";
55 const string& solution,
65 #ifdef USE_TESTMANAGER_AUTOREGISTER
70 #if defined(USE_GROUP_SU2)
74 "Spectrum.CRSMatrix.Clover_Lexical",
87 vout.
general(
"CRSMatrix test: node-parallel unsupported. skip.\n");
101 const string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
102 const string readfile = params_test.
get_string(
"config_filename_input");
103 const string matrix_file = params_test.
get_string(
"matrix_output");
104 const string source_file = params_test.
get_string(
"source_output");
105 const string solution_file = params_test.
get_string(
"solution_output");
106 const string str_vlevel = params_test.
get_string(
"verbose_level");
108 const bool do_check = params_test.
is_set(
"expected_result");
109 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
114 vout.
general(
vl,
" gconf_read = %s\n", str_gconf_read.c_str());
116 vout.
general(
vl,
" matrix_output = %s\n", matrix_file.c_str());
117 vout.
general(
vl,
" source_output = %s\n", source_file.c_str());
118 vout.
general(
vl,
" solution_output = %s\n", solution_file.c_str());
131 vout.
crucial(
vl,
"Error: Test_Spectrum_CRSMatrix: input parameters have not been set\n");
145 std::vector<int> boundary { -1, -1, -1, -1 };
146 std::string repr =
"Dirac";
149 params_c.
set_string(
"gamma_matrix_type", repr);
150 params_c.
set_double(
"hopping_parameter", kappa);
151 params_c.
set_double(
"clover_coefficient", cSW);
153 params_c.
set_string(
"verbose_level", str_vlevel.c_str());
155 unique_ptr<Fopr> fopr_c(
new Fopr_Clover(params_c));
156 fopr_c->set_config(&U);
157 fopr_c->set_mode(
"D");
159 unique_ptr<Fopr_CRS> fopr_crs(
new Fopr_CRS(fopr_c.get()));
160 fopr_crs->write_matrix(matrix_file);
164 double Stop_cond = 1.0e-28;
165 bool use_init_guess =
false;
168 params_solver.
set_int(
"maximum_number_of_iteration", Niter);
169 params_solver.
set_int(
"maximum_number_of_restart", Nrestart);
170 params_solver.
set_double(
"convergence_criterion_squared", Stop_cond);
171 params_solver.
set_bool(
"use_initial_guess", use_init_guess);
172 params_solver.
set_string(
"verbose_level", str_vlevel.c_str());
181 std::vector<int> source_position { 0, 0, 0, 0 };
185 params_source.
set_string(
"verbose_level", str_vlevel.c_str());
187 unique_ptr<Source> source(
new Source_Local(params_source));
190 std::vector<Field_F> sq(Nc * Nd);
191 for (
int idx = 0;
idx < Nc * Nd; ++
idx) {
195 for (
int ispin = 0; ispin < Nd; ++ispin) {
196 for (
int icolor = 0; icolor < Nc; ++icolor) {
197 int idx = icolor + Nc * ispin;
205 fopr_c->set_mode(
"D");
206 fopr_c->mult_dag(b2, b);
211 fopr_c->set_mode(
"DdagD");
212 solver->solve(xq, b2, Nconv, diff_CG);
213 vout.
general(
vl,
" ispin = %2d icolor = %2d Nconv = %4d diff = %12.6e\n",
214 ispin, icolor, Nconv, diff_CG);
219 fopr_c->set_mode(
"D");
227 sq[icolor + Nc * ispin] = xq;
233 unique_ptr<Solver> solver_crs(
new Solver_CG(fopr_crs2));
234 solver_crs->set_parameters(Niter, Stop_cond);
244 source->set(b, icolor, ispin);
246 fopr_crs2->set_mode(
"Ddag");
251 fopr_crs2->set_mode(
"DdagD");
252 solver_crs->solve(xq, b2, Nconv, diff_CG);
253 vout.
general(
vl,
" ispin = %2d icolor = %2d Nconv = %4d diff = %12.6e\n",
254 ispin, icolor, Nconv, diff_CG);
257 fopr_crs2->set_mode(
"D");
262 sq[icolor + Nc * ispin] = xq;
269 CRSsolver(solution_file, matrix_file, source_file, result);