21 template<
typename AFIELD>
23 =
"AFopr_Domainwall_eo";
26 template<
typename AFIELD>
38 string vlevel = params.
get_string(
"verbose_level");
41 vout.
general(m_vl,
"%s: Initialization start\n", class_name.c_str());
45 std::string kernel_type;
48 vout.
crucial(m_vl,
"Error at %s: kernel_type is not specified.\n",
58 vout.
crucial(m_vl,
"Error at %s: domain_wall_height is not specified.\n",
64 double kappa = 1.0 / (8.0 - 2.0 * M0);
65 params_kernel.
set_double(
"hopping_parameter", kappa);
69 m_foprw->set_mode(
"D");
73 set_parameters(params);
75 m_w4.reset(m_NinF, m_Nvol2, 1);
76 m_v4.reset(m_NinF, m_Nvol2, 1);
77 m_y4.reset(m_NinF, m_Nvol2, 1);
78 m_t4.reset(m_NinF, m_Nvol2, 1);
80 if (needs_convert()) {
81 m_w4lex.reset(m_NinF, m_Nvol, 1);
82 m_v4lex.reset(m_NinF, m_Nvol, 1);
91 template<
typename AFIELD>
100 template<
typename AFIELD>
104 const string str_vlevel = params.
get_string(
"verbose_level");
114 int err_optional = 0;
115 err_optional += params.
fetch_string(
"gamma_matrix_type", gmset_type);
120 err += params.
fetch_int(
"extent_of_5th_dimension", Ns);
126 vout.
crucial(m_vl,
"Error at %s: input parameter not found.\n",
133 if (
real_t(M0) != m_M0) set_kernel_parameters(params);
138 template<
typename AFIELD>
143 const std::vector<int> bc,
151 m_boundary.resize(m_Ndim);
152 assert(bc.size() == m_Ndim);
153 for (
int mu = 0; mu < m_Ndim; ++mu) {
154 m_boundary[mu] = bc[mu];
157 if (m_b.size() != m_Ns) {
161 for (
int is = 0; is < m_Ns; ++is) {
166 vout.
general(m_vl,
"Parameters of %s:\n", class_name.c_str());
170 for (
int mu = 0; mu < m_Ndim; ++mu) {
171 vout.
general(m_vl,
" boundary[%d] = %2d\n", mu, m_boundary[mu]);
176 for (
int is = 0; is < m_Ns; ++is) {
177 vout.
general(m_vl,
" b[%2d] = %16.10f c[%2d] = %16.10f\n",
178 is, m_b[is], is, m_c[is]);
182 set_precond_parameters();
185 if (m_w1.nex() != Ns) {
186 m_w1.reset(m_NinF, m_Nvol2, m_Ns);
187 m_v1.reset(m_NinF, m_Nvol2, m_Ns);
188 m_v2.reset(m_NinF, m_Nvol2, m_Ns);
194 template<
typename AFIELD>
203 double kappa = 1.0 / (8.0 - 2.0 * M0);
204 params_kernel.
set_double(
"hopping_parameter", kappa);
206 m_foprw->set_parameters(params_kernel);
211 template<
typename AFIELD>
214 if (m_dp.size() != m_Ns) {
217 m_e.resize(m_Ns - 1);
218 m_f.resize(m_Ns - 1);
221 for (
int is = 0; is < m_Ns; ++is) {
222 m_dp[is] = 1.0 + m_b[is] * (4.0 - m_M0);
223 m_dm[is] = 1.0 - m_c[is] * (4.0 - m_M0);
226 m_e[0] = m_mq * m_dm[m_Ns - 1] / m_dp[0];
227 m_f[0] = m_mq * m_dm[0];
228 for (
int is = 1; is < m_Ns - 1; ++is) {
229 m_e[is] = m_e[is - 1] * m_dm[is - 1] / m_dp[is];
230 m_f[is] = m_f[is - 1] * m_dm[is] / m_dp[is - 1];
233 m_g = m_e[m_Ns - 2] * m_dm[m_Ns - 2];
238 template<
typename AFIELD>
240 const std::vector<real_t> vec_b,
241 const std::vector<real_t> vec_c)
243 if ((vec_b.size() != m_Ns) || (vec_c.size() != m_Ns)) {
244 vout.
crucial(m_vl,
"%s: size of coefficient vectors incorrect.\n",
248 vout.
general(m_vl,
"%s: coefficient vectors are set:\n",
251 for (
int is = 0; is < m_Ns; ++is) {
254 vout.
general(m_vl,
"b[%2d] = %16.10f c[%2d] = %16.10f\n",
255 is, m_b[is], is, m_c[is]);
258 set_precond_parameters();
263 template<
typename AFIELD>
266 if (!needs_convert()) {
267 vout.
crucial(m_vl,
"%s: convert is not necessary.\n",
275 for (
int ex = 0; ex < Nex; ++ex) {
276 copy(m_w4lex, 0, w, ex);
277 m_foprw->convert(m_v4lex, m_w4lex);
278 copy(v, ex, m_v4lex, 0);
286 template<
typename AFIELD>
289 if (!needs_convert()) {
290 vout.
crucial(m_vl,
"%s: convert is not necessary.\n",
298 for (
int ex = 0; ex < Nex; ++ex) {
299 copy(m_v4lex, 0, w, ex);
300 m_foprw->reverse(m_w4lex, m_v4lex);
301 copy(v, ex, m_w4lex, 0);
309 template<
typename AFIELD>
315 if (ith == 0) m_mode = mode;
323 template<
typename AFIELD>
328 }
else if (m_mode ==
"Ddag") {
330 }
else if (m_mode ==
"DdagD") {
332 }
else if (m_mode ==
"DDdag") {
335 }
else if (m_mode ==
"H") {
338 vout.
crucial(m_vl,
"mode undeifined in %s.\n", class_name.c_str());
339 vout.
crucial(m_vl,
"in mult, mode=%s.\n", m_mode.c_str());
346 template<
typename AFIELD>
351 }
else if (m_mode ==
"Ddag") {
353 }
else if (m_mode ==
"DdagD") {
355 }
else if (m_mode ==
"DDdag") {
358 }
else if (m_mode ==
"H") {
361 vout.
crucial(m_vl,
"mode undeifined in %s.\n", class_name.c_str());
362 vout.
crucial(m_vl,
"in mult_dag, mode=%s.\n", m_mode.c_str());
369 template<
typename AFIELD>
378 }
else if (mode ==
"Doe") {
380 }
else if (mode ==
"Dee") {
382 }
else if (mode ==
"Doo") {
384 }
else if (mode ==
"Dee_inv") {
387 }
else if (mode ==
"Doo_inv") {
391 std::cout <<
"mode undeifined in AFopr_Domainwall_eo.\n";
397 template<
typename AFIELD>
404 m_index_eo->split(Be, m_w1, b);
414 Udag_inv(m_v1, m_w1);
416 Ddag_eo(m_w1, bo, 0);
422 template<
typename AFIELD>
439 m_index_eo->merge(x, xe, m_w1);
442 Ldag_inv(m_v2, m_v1);
443 Ddag_eo(m_w1, m_v2, 1);
444 Udag_inv(m_v1, m_w1);
445 Ldag_inv(m_w1, m_v1);
448 m_index_eo->merge(x, m_v2, m_w1);
456 template<
typename AFIELD>
484 template<
typename AFIELD>
501 template<
typename AFIELD>
521 template<
typename AFIELD>
528 Ldag_inv(m_v2, m_v1);
529 Ddag_eo(m_v1, m_v2, 1);
530 Udag_inv(m_v2, m_v1);
531 Ldag_inv(m_v1, m_v2);
532 Ddag_eo(m_v2, m_v1, 0);
541 template<
typename AFIELD>
550 Ldag_inv(m_v2, m_v1);
551 Ddag_eo(m_v1, m_v2, 1);
552 Udag_inv(m_v2, m_v1);
553 Ldag_inv(m_v1, m_v2);
554 Ddag_eo(m_v2, m_v1, 0);
563 template<
typename AFIELD>
567 assert(Nex == w.
nex());
575 for (
int ex = 0; ex < Nex; ++ex) {
576 copy(m_w4, 0, w, ex);
577 m_foprw->mult_gm5(m_v4, m_w4);
578 copy(v, ex, m_v4, 0);
586 template<
typename AFIELD>
590 m_foprw->mult_gm5(v, w);
595 template<
typename AFIELD>
603 for (
int is = 0; is < m_Ns; ++is) {
604 copy(v, m_Ns - 1 - is, w, is);
612 template<
typename AFIELD>
620 for (
int is = 0; is < m_Ns; ++is) {
621 copy(m_w4, 0, w, is);
622 mult_gm5_4d(m_v4, m_w4);
623 copy(v, m_Ns - 1 - is, m_v4, 0);
631 template<
typename AFIELD>
637 for (
int is = 0; is < m_Ns; ++is) {
639 int is_up = (is + 1) % m_Ns;
641 if (is == m_Ns - 1) Fup = m_mq / 2.0;
642 copy(m_y4, 0, w, is_up);
643 mult_gm5_4d(m_t4, m_y4);
645 axpy(m_v4, 0, Fup, m_y4, 0);
647 int is_dn = (is - 1 + m_Ns) % m_Ns;
649 if (is == 0) Fdn = m_mq / 2.0;
650 copy(m_y4, 0, w, is_dn);
651 mult_gm5_4d(m_t4, m_y4);
653 axpy(m_v4, 0, Fdn, m_y4, 0);
655 copy(m_w4, 0, w, is);
658 axpy(m_w4, -m_c[is], m_v4);
662 m_foprw->mult(m_v4, m_w4,
"Deo");
664 m_foprw->mult(m_v4, m_w4,
"Doe");
669 copy(v, is, m_v4, 0);
677 template<
typename AFIELD>
687 for (
int is = 0; is < m_Ns; ++is) {
688 copy(m_w4, 0, w, is);
691 mult_gm5_4d(m_v4, m_w4);
693 m_foprw->mult(m_y4, m_v4,
"Deo");
695 m_foprw->mult(m_y4, m_v4,
"Doe");
697 mult_gm5_4d(m_v4, m_y4);
700 axpy(v, is, m_b[is], m_v4, 0);
702 scal(m_v4, -m_c[is]);
704 int is_up = (is + 1) % m_Ns;
706 if (is_up == 0) Fup = m_mq / 2.0;
707 mult_gm5_4d(m_y4, m_v4);
709 axpy(v, is_up, -Fup, m_y4, 0);
711 int is_dn = (is - 1 + m_Ns) % m_Ns;
713 if (is_dn == m_Ns - 1) Fdn = m_mq / 2.0;
714 mult_gm5_4d(m_y4, m_v4);
716 axpy(v, is_dn, Fdn, m_y4, 0);
724 template<
typename AFIELD>
730 for (
int is = 0; is < m_Ns; ++is) {
732 int is_up = (is + 1) % m_Ns;
734 if (is == m_Ns - 1) Fup = m_mq / 2.0;
735 copy(m_y4, 0, w, is_up);
736 mult_gm5_4d(m_t4, m_y4);
738 axpy(m_v4, 0, Fup, m_y4, 0);
740 int is_dn = (is - 1 + m_Ns) % m_Ns;
742 if (is == 0) Fdn = m_mq / 2.0;
743 copy(m_y4, 0, w, is_dn);
744 mult_gm5_4d(m_t4, m_y4);
746 axpy(m_v4, 0, Fdn, m_y4, 0);
748 copy(m_w4, 0, w, is);
753 axpy(m_w4, -m_c[is], m_v4);
756 copy(v, is, m_t4, 0);
764 template<
typename AFIELD>
775 for (
int is = 1; is < m_Ns - 1; ++is) {
778 copy(m_v4, 0, v, is - 1);
779 mult_gm5_4d(m_w4, m_v4);
781 scal(m_v4,
real_t(0.5) * m_dm[is] / m_dp[is - 1]);
784 copy(m_w4, 0, v, is);
785 axpy(m_y4, m_e[is], m_w4);
792 copy(m_v4, 0, v, is - 1);
793 mult_gm5_4d(m_w4, m_v4);
795 scal(m_v4,
real_t(0.5) * m_dm[is] / m_dp[is - 1]);
799 mult_gm5_4d(m_w4, m_y4);
809 template<
typename AFIELD>
815 copy(m_y4, 0, w, is);
817 copy(v, is, m_y4, 0);
819 mult_gm5_4d(m_w4, m_y4);
825 for (
int is = m_Ns - 2; is >= 0; --is) {
826 copy(m_v4, 0, w, is);
828 copy(m_w4, 0, v, is + 1);
829 mult_gm5_4d(m_t4, m_w4);
834 axpy(m_v4, -m_f[is], m_y4);
838 copy(v, is, m_v4, 0);
846 template<
typename AFIELD>
860 for (
int is = 1; is < m_Ns - 1; ++is) {
861 copy(m_t4, 0, w, is);
863 copy(m_v4, 0, v, is - 1);
864 mult_gm5_4d(m_w4, m_v4);
869 copy(v, is, m_t4, 0);
871 axpy(m_y4, m_f[is], m_t4);
878 copy(m_t4, 0, w, is);
880 copy(m_v4, 0, v, is - 1);
881 mult_gm5_4d(m_w4, m_v4);
885 mult_gm5_4d(m_w4, m_y4);
892 copy(v, is, m_t4, 0);
899 template<
typename AFIELD>
907 copy(m_y4, 0, w, is);
908 mult_gm5_4d(m_t4, m_y4);
914 for (
int is = m_Ns - 2; is >= 0; --is) {
917 copy(m_v4, 0, v, is + 1);
918 mult_gm5_4d(m_t4, m_v4);
920 scal(m_v4,
real_t(0.5) * m_dm[is + 1] / m_dp[is]);
922 axpy(m_v4, -m_e[is], m_y4);
932 template<
typename AFIELD>
936 double vsite =
static_cast<double>(Lvol2);
937 double vNs =
static_cast<double>(m_Ns);
939 double flop_Wilson = m_foprw->flop_count(
"Deo");
943 double axpy1 =
static_cast<double>(2 * m_NinF) * vsite;
944 double scal1 =
static_cast<double>(1 * m_NinF) * vsite;
946 double flop_Deo = (flop_Wilson + 5.0 * axpy1 + 2.0 * scal1) * vNs;
948 double flop_Dee = vNs * (7.0 * axpy1 + scal1);
951 2.0 * ((3.0 * axpy1 + scal1) * (vNs - 1.0) + axpy1 + 2.0 * scal1);
954 if ((mode ==
"Meo") || (mode ==
"Moe")) {
955 flop = flop_Deo + flop_LU_inv;
956 }
else if ((mode ==
"Dee_inv") || (mode ==
"Doo_inv")) {
958 }
else if ((mode ==
"Deo") || (mode ==
"Doe")) {
960 }
else if ((mode ==
"Dee") || (mode ==
"Doo")) {
962 }
else if ((mode ==
"D") || (mode ==
"Ddag")) {
963 flop = 2.0 * (flop_LU_inv + flop_Deo) + vNs * axpy1;
964 }
else if (mode ==
"DdagD") {
965 flop = 2.0 * (2.0 * (flop_LU_inv + flop_Deo) + vNs * axpy1);
967 vout.
crucial(m_vl,
"Error at %s: input mode %s is undefined.\n",
968 class_name.c_str(), mode.c_str());