44 namespace Test_Spectrum_CRSMatrix {
47 const std::string filename_input =
"test_Spectrum_CRSMatrix_Clover_Lexical.yaml";
54 const string& solution,
64 #ifdef USE_TESTMANAGER_AUTOREGISTER
69 #if defined(USE_GROUP_SU2)
73 "Spectrum.CRSMatrix.Clover_Lexical",
86 vout.
general(
"CRSMatrix test: node-parallel unsupported. skip.\n");
100 const string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
101 const string readfile = params_test.
get_string(
"config_filename_input");
102 const string matrix_file = params_test.
get_string(
"matrix_output");
103 const string source_file = params_test.
get_string(
"source_output");
104 const string solution_file = params_test.
get_string(
"solution_output");
105 const string str_vlevel = params_test.
get_string(
"verbose_level");
107 const bool do_check = params_test.
is_set(
"expected_result");
108 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
113 vout.
general(vl,
" gconf_read = %s\n", str_gconf_read.c_str());
114 vout.
general(vl,
" readfile = %s\n", readfile.c_str());
115 vout.
general(vl,
" matrix_output = %s\n", matrix_file.c_str());
116 vout.
general(vl,
" source_output = %s\n", source_file.c_str());
117 vout.
general(vl,
" solution_output = %s\n", solution_file.c_str());
118 vout.
general(vl,
" vlevel = %s\n", str_vlevel.c_str());
130 vout.
crucial(vl,
"Error: Test_Spectrum_CRSMatrix: input parameters have not been set\n");
144 std::vector<int> boundary(Ndim);
151 params_c.
set_double(
"hopping_parameter", kappa);
152 params_c.
set_double(
"clover_coefficient", cSW);
165 double Stop_cond = 1.0e-28;
169 std::vector<int> source_position(Ndim);
170 source_position[0] = 0;
171 source_position[1] = 0;
172 source_position[2] = 0;
173 source_position[3] = 0;
182 std::vector<Field_F> sq(Nc * Nd);
185 for (
int ispin = 0; ispin < Nd; ++ispin) {
186 for (
int icolor = 0; icolor < Nc; ++icolor) {
187 int idx = icolor + Nc * ispin;
198 solver->
solve(xq, b2, Nconv, diff_CG);
199 vout.
general(vl,
" ispin = %2d icolor = %2d Nconv = %4d diff = %12.6e\n",
200 ispin, icolor, Nconv, diff_CG);
210 double yy = y.norm2();
213 sq[icolor + Nc * ispin] = xq;
230 source->
set(b, icolor, ispin);
232 fopr_crs2->set_mode(
"Ddag");
237 fopr_crs2->set_mode(
"DdagD");
238 solver_crs->
solve(xq, b2, Nconv, diff_CG);
239 vout.
general(vl,
" ispin = %2d icolor = %2d Nconv = %4d diff = %12.6e\n",
240 ispin, icolor, Nconv, diff_CG);
243 fopr_crs2->set_mode(
"D");
248 sq[icolor + Nc * ispin] = xq;
255 CRSsolver(solution_file, matrix_file, source_file, result);
261 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 set_int_vector(const string &key, const vector< int > &value)
void general(const char *format,...)
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
Container of Field-type object.
Standard Conjugate Gradient solver algorithm.
Wilson-type fermion field.
virtual void set_parameters(const Parameters ¶ms)=0
Parameters lookup(const string &key) const
static bool RegisterTest(const std::string &key, const Test_function func)
double get_double(const string &key) const
int CRSsolver(const string &solution, const string &matrix, const string &source, double &result)
void write_matrix(std::string)
virtual void set_parameters(const Parameters &)=0
int non_NULL(const std::string v)
bool is_set(const string &key) const
virtual void set(Field &, int)=0
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,...)
static void read(const std::string ¶ms_file, Parameters ¶ms)
void read_file(Field_G *U, const string &filename)
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...
GaugeConfig class for file I/O of gauge configuration.
virtual void mult_dag(Field &, const Field &)
hermitian conjugate of mult(Field&, const Field&).
string get_string(const string &key) const
Fermion operator with CRS matrix format.
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
virtual void set_parameters(const Parameters &)=0
static VerboseLevel set_verbose_level(const std::string &str)