Go to the documentation of this file.
48 const std::string filename_input =
"test_Spectrum_CRSMatrix_Domainwall.yaml";
49 const std::string filename_output =
"stdout";
56 const string& solution,
65 #ifdef USE_TESTMANAGER_AUTOREGISTER
73 "Spectrum.CRSMatrix.Domainwall",
94 const string str_gconf_read = params_test.
get_string(
"gauge_config_type_input");
95 const string readfile = params_test.
get_string(
"config_filename_input");
96 const string matrix_file = params_test.
get_string(
"matrix_output");
97 const string source_file = params_test.
get_string(
"source_output");
98 const string solution_file = params_test.
get_string(
"solution_output");
99 const string str_vlevel = params_test.
get_string(
"verbose_level");
101 const bool do_check = params_test.
is_set(
"expected_result");
102 const double expected_result = do_check ? params_test.
get_double(
"expected_result") : 0.0;
107 vout.
general(
vl,
" gconf_read = %s\n", str_gconf_read.c_str());
109 vout.
general(
vl,
" matrix_output = %s\n", matrix_file.c_str());
110 vout.
general(
vl,
" source_output = %s\n", source_file.c_str());
111 vout.
general(
vl,
" solution_output = %s\n", solution_file.c_str());
124 vout.
crucial(
vl,
"Error: Test_Spectrum_CRSMatrix: input parameters have not been set\n");
136 const double mq = 0.1;
137 const double M0 = 1.6;
139 std::vector<int> boundary(Ndim);
148 params_dw.
set_double(
"domain_wall_height", M0);
149 params_dw.
set_int(
"extent_of_5th_dimension", Ns);
162 fopr_dw->set_config(&U);
163 fopr_dw->set_mode(
"D");
165 unique_ptr<Fopr_CRS> fopr_crs(
new Fopr_CRS(fopr_dw.get()));
166 fopr_crs->write_matrix(matrix_file);
173 std::vector<int> source_position { 0, 0, 0, 0 };
177 unique_ptr<Source> source(Source::New(
"Local", params_source));
183 double Stop_cond = 1.0e-28;
184 bool use_init_guess =
false;
187 params_solver.
set_int(
"maximum_number_of_iteration", Niter);
188 params_solver.
set_int(
"maximum_number_of_restart", Nrestart);
189 params_solver.
set_double(
"convergence_criterion_squared", Stop_cond);
190 params_solver.
set_double(
"use_initial_guess", use_init_guess);
192 unique_ptr<Solver>
solver(
new Solver_CG(fopr_dw.get(), params_solver));
196 const int Nin = 2 * Nc * Nd;
199 for (
int ispin = 0; ispin < Nd; ++ispin) {
200 for (
int icolor = 0; icolor < Nc; ++icolor) {
201 for (
int ch = -1; ch <= 1; ch = ch + 2) {
202 int idx = icolor + Nc * ispin;
207 Field bt(Nin, Nvol, 1);
208 fopr_dw->mult_chproj_4d(bt, b, ch);
210 Field bt_5d(Nin, Nvol, Nex);
221 Field b_5d(Nin, Nvol, Nex);
222 fopr_dw->set_mode(
"Ddag");
223 fopr_dw->mult(b_5d, bt_5d);
227 Field xq_5d(Nin, Nvol, Nex);
230 fopr_dw->set_mode(
"DdagD");
231 solver->solve(xq_5d, b_5d, Nconv, diff);
233 vout.
general(
vl,
" Nconv = %d, diff = %16.8e\n", Nconv, diff);
242 CRSsolver(solution_file, matrix_file, source_file, result);
int verify(const double result, const double expected, double eps)
void setpart_ex(int ex, const Field &w, int exw)
int non_NULL(const std::string v)
void set(const int jin, const int site, const int jex, double v)
void set_double(const string &key, const double value)
void detailed(const char *format,...)
Test of CRS matrix format.
int idx(const int in, const int Nin, const int ist, const int leo, const int Nvol2, const int ex)
AFopr_Domainwall< Field > Fopr_Domainwall
Domain-wall fermion operator.
static void read(const std::string ¶ms_file, Parameters ¶ms)
double get_double(const string &key) const
int solver(const std::string &)
void set_int_vector(const string &key, const vector< int > &value)
int CRSsolver(const string &solution, const string &matrix, const string &source, double &result)
void read_text(Field &f, const string &filename)
GaugeConfig class for file I/O of gauge configuration.
static VerboseLevel set_verbose_level(const std::string &str)
bool is_set(const string &key) const
Fermion operator with CRS matrix format.
void read_file(Field_G &U, const string &filename)
void set_int(const string &key, const int value)
void write_text(const Field &f, const string &filename)
Wilson-type fermion field.
string get_string(const string &key) const
void crucial(const char *format,...)
Standard Conjugate Gradient solver algorithm.
Container of Field-type object.
void general(const char *format,...)
Parameters lookup(const string &key) const
static bool RegisterTest(const std::string &key, const Test_function func)