30 #ifdef USE_TESTMANAGER_AUTOREGISTER
51 namespace Test_Spectrum_CRSMatrix {
54 const std::string filename_input =
"test_Spectrum_CRSMatrix_Clover_Lexical.yaml";
55 const std::string filename_output =
"stdout";
57 class Parameters_Test_Spectrum_CRSMatrix :
public Parameters {
59 Parameters_Test_Spectrum_CRSMatrix()
61 Register_string(
"gauge_config_type_input",
"NULL");
62 Register_string(
"config_filename_input",
"NULL");
64 Register_string(
"matrix_output",
"NULL");
65 Register_string(
"source_output",
"NULL");
66 Register_string(
"solution_output",
"NULL");
68 Register_string(
"verbose_level",
"NULL");
70 Register_double(
"expected_result", 0.0);
79 const string& solution,
89 #ifdef USE_TESTMANAGER_AUTOREGISTER
96 #if defined(USE_GROUP_SU2)
100 "Spectrum.CRSMatrix.Clover_Lexical",
118 Parameters_Test_Spectrum_CRSMatrix params_test;
125 params_manager.
read_params(filename_input, ¶ms_all);
127 const string str_gconf_read = params_test.get_string(
"gauge_config_type_input");
128 const string readfile = params_test.get_string(
"config_filename_input");
129 const string matrix_file = params_test.get_string(
"matrix_output");
130 const string source_file = params_test.get_string(
"source_output");
131 const string solution_file = params_test.get_string(
"solution_output");
132 const string str_vlevel = params_test.get_string(
"verbose_level");
134 const bool do_check = params_test.is_set(
"expected_result");
135 const double expected_result = do_check ? params_test.get_double(
"expected_result") : 0.0;
140 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
141 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
142 vout.
general(vl,
" matrix_output = %s\n", matrix_file.c_str());
143 vout.
general(vl,
" source_output = %s\n", source_file.c_str());
144 vout.
general(vl,
" solution_output = %s\n", solution_file.c_str());
145 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
157 vout.
crucial(vl,
"Test_Spectrum_CRSMatrix: Input parameters have not been set.\n");
173 valarray<int> boundary(Ndim);
186 double Stop_cond = 1.0e-28;
190 valarray<int> source_position(Ndim);
191 source_position[0] = 0;
192 source_position[1] = 0;
193 source_position[2] = 0;
194 source_position[3] = 0;
201 valarray<Field_F> sq(Nc * Nd);
211 source->
set(b, icolor, ispin);
222 solver->
solve(xq, b2, Nconv, diff_CG);
223 vout.
general(vl,
" ispin = %2d icolor = %2d Nconv = %4d diff = %12.6e\n",
224 ispin, icolor, Nconv, diff_CG);
239 double yy = y.
norm2();
242 sq[icolor + Nc * ispin] = xq;
260 source->
set(b, icolor, ispin);
262 fopr_crs2->set_mode(
"Ddag");
267 fopr_crs2->set_mode(
"DdagD");
268 solver_crs->
solve(xq, b2, Nconv, diff_CG);
269 vout.
general(vl,
" ispin = %2d icolor = %2d Nconv = %4d diff = %12.6e\n",
270 ispin, icolor, Nconv, diff_CG);
273 fopr_crs2->set_mode(
"D");
278 sq[icolor + Nc * ispin] = xq;
285 CRSsolver(solution_file, matrix_file, source_file, result);
307 vout.
detailed(vl,
"check skipped: expected_result not set.\n\n");
void read_params(const std::string ¶ms_file, Parameters *params)
read parameters from file.
void detailed(const char *format,...)
void general(const char *format,...)
const Field mult(const Field &f)
multiplies fermion operator to a given field and returns the resultant field.
Container of Field-type object.
const Field mult_dag(const Field &f)
hermitian conjugate of mult(const Field&).
void set(Field_F &src, int ic, int id)
Standard Conjugate Gradient solver algorithm.
Wilson-type fermion field.
virtual void set_parameters(const Parameters ¶ms)=0
static bool RegisterTest(const std::string &key, const Test_function func)
void set_config(Field *U)
setting pointer to the gauge configuration.
int CRSsolver(const string &solution, const string &matrix, const string &source, double &result)
void write_matrix(std::string)
int non_NULL(const std::string v)
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)
Base class for linear solver class family.
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)
Fermion operator with CRS matrix format.
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
void set_parameters(const Parameters ¶ms)
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
static VerboseLevel set_verbose_level(const std::string &str)
void set_parameters(const Parameters ¶ms)