47 const std::string filename_input =
"test_Spectrum_CRSMatrix_Clover_Lexical.yaml";
48 const std::string filename_output =
"stdout";
50 class Parameters_Test_Spectrum_CRSMatrix :
public Parameters {
52 Parameters_Test_Spectrum_CRSMatrix()
54 Register_string(
"gauge_config_type_input",
"NULL");
55 Register_string(
"config_filename_input",
"NULL");
57 Register_string(
"matrix_output",
"NULL");
58 Register_string(
"source_output",
"NULL");
59 Register_string(
"solution_output",
"NULL");
61 Register_string(
"verbose_level",
"NULL");
63 Register_double(
"expected_result", 0.0);
72 const string& solution,
82 #ifdef USE_TESTMANAGER_AUTOREGISTER
89 #if defined(USE_GROUP_SU2)
93 "Spectrum.CRSMatrix.Clover_Lexical",
111 Parameters_Test_Spectrum_CRSMatrix params_test;
119 const string str_gconf_read = params_test.get_string(
"gauge_config_type_input");
120 const string readfile = params_test.get_string(
"config_filename_input");
121 const string matrix_file = params_test.get_string(
"matrix_output");
122 const string source_file = params_test.get_string(
"source_output");
123 const string solution_file = params_test.get_string(
"solution_output");
124 const string str_vlevel = params_test.get_string(
"verbose_level");
126 const bool do_check = params_test.is_set(
"expected_result");
127 const double expected_result = do_check ? params_test.get_double(
"expected_result") : 0.0;
132 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
133 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
134 vout.
general(vl,
" matrix_output = %s\n", matrix_file.c_str());
135 vout.
general(vl,
" source_output = %s\n", source_file.c_str());
136 vout.
general(vl,
" solution_output = %s\n", solution_file.c_str());
137 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
149 vout.
crucial(vl,
"Test_Spectrum_CRSMatrix: Input parameters have not been set.\n");
163 std::vector<int> boundary(Ndim);
170 params_c->
set_double(
"hopping_parameter", kappa);
171 params_c->
set_double(
"clover_coefficient", cSW);
183 double Stop_cond = 1.0e-28;
187 std::vector<int> source_position(Ndim);
188 source_position[0] = 0;
189 source_position[1] = 0;
190 source_position[2] = 0;
191 source_position[3] = 0;
198 std::vector<Field_F> sq(Nc * Nd);
208 source->
set(b, icolor, ispin);
219 solver->
solve(xq, b2, Nconv, diff_CG);
220 vout.
general(vl,
" ispin = %2d icolor = %2d Nconv = %4d diff = %12.6e\n",
221 ispin, icolor, Nconv, diff_CG);
239 sq[icolor + Nc * ispin] = xq;
256 source->
set(b, icolor, ispin);
258 fopr_crs2->set_mode(
"Ddag");
263 fopr_crs2->set_mode(
"DdagD");
264 solver_crs->
solve(xq, b2, Nconv, diff_CG);
265 vout.
general(vl,
" ispin = %2d icolor = %2d Nconv = %4d diff = %12.6e\n",
266 ispin, icolor, Nconv, diff_CG);
269 fopr_crs2->set_mode(
"D");
274 sq[icolor + Nc * ispin] = xq;
281 CRSsolver(solution_file, matrix_file, source_file, result);
287 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
void scal(Field &x, const double a)
scal(x, a): x = a * x
void detailed(const char *format,...)
void general(const char *format,...)
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
Container of Field-type object.
void set(Field_F &src, int ic, int id)
static Parameters * New(const std::string &realm)
Standard Conjugate Gradient solver algorithm.
void read_file(Field *U, const string &filename)
Wilson-type fermion field.
virtual void set_parameters(const Parameters ¶ms)=0
static bool RegisterTest(const std::string &key, const Test_function func)
int CRSsolver(const string &solution, const string &matrix, const string &source, double &result)
virtual void set_parameters(const Parameters &)=0
int non_NULL(const std::string v)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void write_text(const Field &f, const string &filename)
void crucial(const char *format,...)
void Register_Parameters(const string &, Parameters *const)
void read_text(Field &f, const string &filename)
int verify(const double result, const double expected, double eps)
void set_double(const string &key, const double value)
virtual void mult(Field &, const Field &)=0
multiplies fermion operator to a given field (2nd argument)
virtual void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
static void read(const std::string ¶ms_file, Parameters *params)
Test of CRS matrix format.
GaugeConfig class for file I/O of gauge configuration.
virtual void mult_dag(Field &, const Field &)
hermitian conjugate of mult(Field&, const Field&).
void set_int_vector(const string &key, const std::vector< int > &value)
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
void set_parameters(const Parameters ¶ms)
static VerboseLevel set_verbose_level(const std::string &str)