22 using namespace Eigen;
27 CCGMShiftedFamilySolver::CCGMShiftedFamilySolver()
59 REQUIRE(A,
"Operator is NULL!\n");
65 "weights are not equal! [%d vs %d]\n", shifts.
vlen, weights.
vlen);
68 MatrixXcd x_sh=MatrixXcd::Zero(b.
vlen, shifts.
vlen);
69 MatrixXcd p_sh=MatrixXcd::Zero(b.
vlen, shifts.
vlen);
117 SG_DEBUG(
"CG iteration %d, residual norm %f\n",
148 x_sh.col(i)-=beta_sh[i]*p_sh.col(i);
159 alpha=r_norm2_i/r_norm2;
171 p_sh.col(i)*=alpha_sh[i];
172 p_sh.col(i)+=zeta_sh_new[i]*r;
178 zeta_sh_old[i]=zeta_sh_cur[i];
179 zeta_sh_cur[i]=zeta_sh_new[i];
189 SG_INFO(
"Iteration took %ld times, residual norm=%.20lf, time elapsed=%lf\n",
194 result.set_const(0.0);
195 Map<VectorXcd> x(result.vector, result.vlen);
197 for (
index_t i=0; i<x_sh.cols(); ++i)
198 x+=x_sh.col(i)*weights[i];
205 #endif // HAVE_EIGEN3