From 2abfcebb0eb7989e3d1e7d03f37ecf5c088210af Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 10 Oct 2020 18:19:55 +1100 Subject: Cleanup: use C comments for descriptive text Follow our code style guide by using C-comments for text descriptions. --- .../intern/ConstrainedConjugateGradient.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source/blender/simulation/intern/ConstrainedConjugateGradient.h') 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); -- cgit v1.2.3