14 #ifndef AFILED_HAS_SUB
15 template<
typename AFIELD>
23 #ifndef AFILED_HAS_ADD
24 template<
typename AFIELD>
33 template<
typename AFIELD>
38 template<
typename AFIELD>
43 int nin = m_fopr->field_nin();
44 int nvol = m_fopr->field_nvol();
45 int nex = m_fopr->field_nex();
47 m_x.reset(nin, nvol, nex);
50 m_r.reset(nin, nvol, nex);
51 m_b.reset(nin, nvol, nex);
57 ret = posix_memalign(&p, CLS,
sizeof(scs_t) * vols * 2);
59 ret = posix_memalign(&p, CLS,
sizeof(scs_t) * vols * 2);
62 vout.
crucial(m_vl,
"%s: allocation failed\n", class_name.c_str());
67 m_fopr->set_mode(
"D");
74 template<
typename AFIELD>
90 template<
typename AFIELD>
93 const string str_vlevel = params.
get_string(
"verbose_level");
102 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
103 err += params.
fetch_int(
"maximum_number_of_restart", Nrestart);
104 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
107 vout.
crucial(m_vl,
"Error at %s: input parameter not found.\n",
112 int Niter2 = Niter * Nrestart;
113 set_parameters(Niter2, Stop_cond);
118 template<
typename AFIELD>
125 m_Stop_cond = Stop_cond;
126 std::string prec =
"double";
127 if (
sizeof(
real_t) == 4) prec =
"float";
131 vout.
general(m_vl,
" Precision: %s\n", prec.c_str());
143 int Nvol2 = Nx * Ny * Nz * Nt / 2;
144 double flop_clv = 576;
146 = 2 * ((Nx2 - 1) * Ny * Nz * Nt * 168 + Nx2 * (Ny - 1) * Nz * Nt * 168
147 + Nx2 * Ny * (Nz - 1) * Nt * 168 + Nx2 * Ny * Nz * (Nt - 1) * 156);
148 double flop_DEE_proc = (48 + flop_clv) * Nvol2 + flop_sap_hops;
150 = (2 * Nvol2 - 2 * (Nx2 - 2) * (Ny - 2) * (Nz - 2) * (Nt - 2)) * 624
151 + 2 * (Nx2 * Nz * Nt * 168 + Nx2 * Nz * Nt * 168 + Nx2 * Ny * Nt * 168 + Nx2 * Ny * Nz * 156);
153 double flop_AEE_proc = m_nm * (flop_DEE_proc + 48 * Nvol2);
155 = m_Niter * (2 * flop_AEE_proc
158 + 2 * 2 * 12 * Nvol2);
159 flop += 2 * flop_AEE_proc + flop_DEO_proc;
160 flop += flop_clv * 2 * Nvol2;
166 template<
typename AFIELD>
171 vout.
detailed(m_vl,
"asolver_SAP_QWS: solve, started in %s\n", __func__);
175 m_fopr->convert(x, b);
179 double x2 = x.
norm2();
180 vout.
general(
"hoge: %s: after convert, |in|^2 = %15.7e\n", class_name.c_str(), x2);
185 m_fopr->mult_clv_inv(x);
189 double x2 = x.
norm2();
190 vout.
general(
"hoge: %s: after mult_clv_inv, |in|^2 = %15.7e\n", class_name.c_str(), x2);
195 prec_s_noprl_((scs_t *)m_x.ptr(0), (scs_t *)x.
ptr(0), &nsap, &nm, m_s, m_q);
200 double x2 = m_x.norm2();
201 m_fopr->convert(m_b, b);
203 m_fopr->mult(m_r, m_x);
205 double r2 = m_r.norm2();
207 vout.
general(
"hoge: %s: before reverse, |res|^2 = %15.7e\n", class_name.c_str(), r2);
208 vout.
general(
"hoge: %s: |out|^2 = %15.7e\n", class_name.c_str(), x2);
212 m_fopr->reverse(x, m_x);
216 double x2 = x.
norm2();
217 vout.
general(
"hoge: %s: after reverse, |out|^2 = %15.7e\n", class_name.c_str(), x2);
226 vout.
crucial(m_vl,
"%s: in solve(), USE_QWSLIB is not defined\n", class_name.c_str());
232 template<
typename AFIELD>
241 =
"ASolver_SAP_QWS<AField<float,QXS> >";