36 namespace Test_Spectrum_CRSMatrix
42 const string& solution,
65 const int Niter = 100;
66 const int Nrestart = 40;
67 const double Stop_cond = 1.0e-28;
81 solver->
solve(x, b2, Nconv, diff);
82 vout.
general(vl,
"solver(CG): Nconv = %4d diff = %12.6e\n", Nconv, diff);
86 const double xx = x.
norm2();
102 std::ofstream field_out(filename.c_str());
103 if (!field_out.is_open()) {
104 vout.
crucial(
"Error: Failed to open the text file. %s\n", filename.c_str());
108 vout.
general(
"Writing Field to %s\n", filename.c_str());
110 field_out << f.
nin() << std::endl;
111 field_out << f.
nvol() << std::endl;
112 field_out << f.
nex() << std::endl;
114 field_out.setf(std::ios_base::scientific, std::ios_base::floatfield);
115 field_out.precision(14);
117 for (
int j = 0, n = f.
size(); j < n; ++j) {
118 field_out << f.
cmp(j) << std::endl;
133 std::ifstream field_in(filename.c_str());
134 if (!field_in.is_open()) {
135 vout.
crucial(
"Error: Failed to open the text file. %s\n", filename.c_str());
139 vout.
general(
"Reading Field from %s\n", filename.c_str());
141 int Nin = 0, Nvol = 0, Nex = 0;
146 f.
reset(Nin, Nvol, Nex);
149 for (
int j = 0, n = f.
ntot(); j < n; ++j) {
void set(const int jin, const int site, const int jex, double v)
void general(const char *format,...)
virtual void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
int solver(const std::string &)
static Bridge::VerboseLevel Vlevel()
Container of Field-type object.
double cmp(const int jin, const int site, const int jex) const
Standard Conjugate Gradient solver algorithm.
virtual void set_parameters(const Parameters ¶ms)=0
int CRSsolver(const string &solution, const string &matrix, const string &source, double &result)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
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 read_text(Field &f, const string &filename)
virtual void mult_dag(Field &, const Field &)
hermitian conjugate of mult(Field&, const Field&).
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0