47 m_rho = m_r0.col(0).dot(m_res.col(0));
49 if (math::abs(m_rho) < m_restartThereshold * m_r0.col(0).dot(m_r0.col(0)) )
51 gsInfo <<
"Residual almost orthogonal, restart with new r0 \n";
53 m_rho = m_r0.col(0).dot(m_r0.col(0));
56 T beta = (m_rho/rho_old)*(m_alpha/m_w);
57 m_p = m_res + beta*(m_p - m_w * m_v);
60 m_precond->apply(m_p, m_y);
62 m_mat->apply(m_y, m_v);
63 m_alpha = m_rho/(m_r0.col(0).dot(m_v.col(0)));
65 m_s.noalias() = m_res - m_alpha * m_v;
67 m_precond->apply(m_s, m_z);
70 m_mat->apply(m_z, m_t);
72 if (m_t.col(0).dot(m_t.col(0)) > 0)
73 m_w = m_t.col(0).dot(m_s.col(0))/m_t.col(0).dot(m_t.col(0));
78 x.noalias() += m_alpha * m_y + m_w * m_z;
79 m_res.noalias() -= m_alpha * m_v + m_w * m_t;
81 m_error = m_res.norm() / m_rhs_norm;
82 return m_error < m_tol;