diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-10 10:19:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-10 14:04:51 +0300 |
commit | 2abfcebb0eb7989e3d1e7d03f37ecf5c088210af (patch) | |
tree | e7a1ad5912b4661d4ece743f4f7fd86e6bf4d3c4 /source/blender/simulation/intern/ConstrainedConjugateGradient.h | |
parent | c735aca42e9f5961fec7e5d5fc196b5bd6b85f56 (diff) |
Cleanup: use C comments for descriptive text
Follow our code style guide by using C-comments for text descriptions.
Diffstat (limited to 'source/blender/simulation/intern/ConstrainedConjugateGradient.h')
-rw-r--r-- | source/blender/simulation/intern/ConstrainedConjugateGradient.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/simulation/intern/ConstrainedConjugateGradient.h b/source/blender/simulation/intern/ConstrainedConjugateGradient.h index b0f2bb037d2..0dc80c03bb5 100644 --- a/source/blender/simulation/intern/ConstrainedConjugateGradient.h +++ b/source/blender/simulation/intern/ConstrainedConjugateGradient.h @@ -60,7 +60,7 @@ EIGEN_DONT_INLINE void constrained_conjugate_gradient(const MatrixType &mat, int n = mat.cols(); - VectorType residual = filter * (rhs - mat * x); // initial residual + VectorType residual = filter * (rhs - mat * x); /* initial residual */ RealScalar rhsNorm2 = (filter * rhs).squaredNorm(); if (rhsNorm2 == 0) { @@ -79,32 +79,32 @@ EIGEN_DONT_INLINE void constrained_conjugate_gradient(const MatrixType &mat, } VectorType p(n); - p = filter * precond.solve(residual); // initial search direction + p = filter * precond.solve(residual); /* initial search direction */ VectorType z(n), tmp(n); RealScalar absNew = numext::real( - residual.dot(p)); // the square of the absolute value of r scaled by invM + residual.dot(p)); /* the square of the absolute value of r scaled by invM */ int i = 0; while (i < maxIters) { - tmp.noalias() = filter * (mat * p); // the bottleneck of the algorithm + tmp.noalias() = filter * (mat * p); /* the bottleneck of the algorithm */ - Scalar alpha = absNew / p.dot(tmp); // the amount we travel on dir - x += alpha * p; // update solution - residual -= alpha * tmp; // update residue + Scalar alpha = absNew / p.dot(tmp); /* the amount we travel on dir */ + x += alpha * p; /* update solution */ + residual -= alpha * tmp; /* update residue */ residualNorm2 = residual.squaredNorm(); if (residualNorm2 < threshold) { break; } - z = precond.solve(residual); // approximately solve for "A z = residual" + z = precond.solve(residual); /* approximately solve for "A z = residual" */ RealScalar absOld = absNew; - absNew = numext::real(residual.dot(z)); // update the absolute value of r + absNew = numext::real(residual.dot(z)); /* update the absolute value of r */ RealScalar beta = absNew / - absOld; // calculate the Gram-Schmidt value used to create the new search direction - p = filter * (z + beta * p); // update search direction + absOld; /* calculate the Gram-Schmidt value used to create the new search direction */ + p = filter * (z + beta * p); /* update search direction */ i++; } tol_error = sqrt(residualNorm2 / rhsNorm2); |