mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 13:40:46 +01:00
Remove some commented stuff
This commit is contained in:
parent
b3d342ca22
commit
176bf37372
@ -68,111 +68,6 @@ class GeneralisedMinimalResidual : public OperatorFunction<Field> {
|
|||||||
bool err_on_no_conv = true)
|
bool err_on_no_conv = true)
|
||||||
: Tolerance(tol), MaxIterations(maxit), RestartLength(restart_length), ErrorOnNoConverge(err_on_no_conv){};
|
: Tolerance(tol), MaxIterations(maxit), RestartLength(restart_length), ErrorOnNoConverge(err_on_no_conv){};
|
||||||
|
|
||||||
// want to solve Ax = b -> A = LinOp, psi = x, b = src
|
|
||||||
|
|
||||||
/* void */
|
|
||||||
/* operator()(LinearOperatorBase<Field> &LinOp, const Field &src, Field &psi)
|
|
||||||
* { */
|
|
||||||
/* typedef typename Eigen::MatrixXcd MyMatrix; */
|
|
||||||
/* typedef typename Eigen::VectorXcd MyVector; */
|
|
||||||
|
|
||||||
/* Field r(src); */
|
|
||||||
/* Field w(src); */
|
|
||||||
/* Field mmv(src); */
|
|
||||||
|
|
||||||
/* std::vector<Field> V(MaxIterations + 1, src); */
|
|
||||||
/* std::vector<std::complex<double>> y(MaxIterations + 1, 0.); */
|
|
||||||
/* std::vector<std::complex<double>> gamma(MaxIterations + 1, 0.); */
|
|
||||||
/* std::vector<std::complex<double>> c(MaxIterations + 1, 0.); */
|
|
||||||
/* std::vector<std::complex<double>> s(MaxIterations + 1, 0.); */
|
|
||||||
|
|
||||||
/* int m = MaxIterations; */
|
|
||||||
|
|
||||||
/* RealD gamma0{}; */
|
|
||||||
|
|
||||||
/* MyMatrix H = Eigen::MatrixXcd::Zero(MaxIterations + 1, MaxIterations); */
|
|
||||||
|
|
||||||
/* RealD normPsiSq = norm2(psi); */
|
|
||||||
/* RealD normSrcSq = norm2(src); */
|
|
||||||
/* RealD TargetResSq = Tolerance * Tolerance * normSrcSq; */
|
|
||||||
|
|
||||||
/* LinOp.Op(psi, mmv); */
|
|
||||||
|
|
||||||
/* r = src - mmv; */
|
|
||||||
/* gamma[0] = norm2(r); */
|
|
||||||
/* std::cout << gamma[0] << std::endl; */
|
|
||||||
/* gamma0 = std::real(gamma[0]); */
|
|
||||||
/* V[0] = (1. / gamma[0]) * r; */
|
|
||||||
|
|
||||||
/* std::cout << GridLogMessage << std::setprecision(4) */
|
|
||||||
/* << "GeneralisedMinimalResidual: psi " << normPsiSq */
|
|
||||||
/* << std::endl; */
|
|
||||||
/* std::cout << GridLogMessage << std::setprecision(4) */
|
|
||||||
/* << "GeneralisedMinimalResidual: src " << normSrcSq */
|
|
||||||
/* << std::endl; */
|
|
||||||
/* std::cout << GridLogMessage << std::setprecision(4) */
|
|
||||||
/* << "GeneralisedMinimalResidual: target " << TargetResSq */
|
|
||||||
/* << std::endl; */
|
|
||||||
/* std::cout << GridLogMessage << std::setprecision(4) */
|
|
||||||
/* << "GeneralisedMinimalResidual: r " << gamma0 <<
|
|
||||||
* std::endl; */
|
|
||||||
|
|
||||||
/* std::cout */
|
|
||||||
/* << GridLogIterative << std::setprecision(4) */
|
|
||||||
/* << "GeneralisedMinimalResidual: before starting to iterate residual "
|
|
||||||
*/
|
|
||||||
/* << gamma0 << " target " << TargetResSq << std::endl; */
|
|
||||||
|
|
||||||
/* for(auto j = 0; j < m; ++j) { */
|
|
||||||
/* LinOp.Op(V[j], w); */
|
|
||||||
|
|
||||||
/* for(auto i = 0; i <= j; ++i) { */
|
|
||||||
/* H(i, j) = innerProduct(V[i], w); */
|
|
||||||
/* w = w - H(i, j) * V[i]; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* H(j + 1, j) = norm2(w); */
|
|
||||||
/* V[j + 1] = (1. / H(j + 1, j)) * w; */
|
|
||||||
|
|
||||||
/* if(std::abs(H(j + 1, j)) > 1e-15) { */
|
|
||||||
/* qrUpdate(gamma, c, s, H, j); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* /\* std::cout << GridLogMessage << "GeneralisedMinimalResidual: H( "
|
|
||||||
* *\/ */
|
|
||||||
/* /\* << j + 1 << "," << j << " ) = " << H( j + 1, j ) *\/ */
|
|
||||||
/* /\* << std::endl; *\/ */
|
|
||||||
|
|
||||||
/* std::cout << GridLogIterative << "GeneralisedMinimalResidual: Iteration
|
|
||||||
* " */
|
|
||||||
/* << j << " residual " << std::abs(gamma[j + 1]) << " target "
|
|
||||||
*/
|
|
||||||
/* << TargetResSq << std::endl; */
|
|
||||||
/* if(std::abs(gamma[j + 1]) / gamma0 < Tolerance) { */
|
|
||||||
/* IterationsToComplete = j; */
|
|
||||||
/* break; */
|
|
||||||
/* } */
|
|
||||||
/* } */
|
|
||||||
/* computeSolution(y, gamma, H, V, psi, IterationsToComplete); */
|
|
||||||
/* std::cout << GridLogMessage */
|
|
||||||
/* << "GeneralisedMinimalResidual: End of operator() after " */
|
|
||||||
/* << IterationsToComplete << " iterations" << std::endl; */
|
|
||||||
|
|
||||||
/* RealD normSrc = sqrt(normSrcSq); */
|
|
||||||
/* RealD resnorm = sqrt(norm2(mmv)); */
|
|
||||||
/* RealD true_residual = resnorm / srcnorm; */
|
|
||||||
/* Field result = mmv; */
|
|
||||||
/* Field Dx(src); */
|
|
||||||
/* Field tmp(src); */
|
|
||||||
|
|
||||||
/* // Test the correctness */
|
|
||||||
/* LinOp.Op(result, Dx); */
|
|
||||||
|
|
||||||
/* tmp = Dx - src; */
|
|
||||||
|
|
||||||
/* std::cout << norm2(tmp) << " " << norm2(tmp) / gamma0 << std::endl; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
void operator()(LinearOperatorBase<Field> &LinOp, const Field &src, Field &psi) {
|
void operator()(LinearOperatorBase<Field> &LinOp, const Field &src, Field &psi) {
|
||||||
|
|
||||||
psi.checkerboard = src.checkerboard;
|
psi.checkerboard = src.checkerboard;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user