diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-08 09:07:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-08 09:07:48 +0300 |
commit | a25c11fd8d602236f36c34c342453149bdc1d909 (patch) | |
tree | c1e537d7ef21767130c459914313517671d0170b /source/blender/physics/intern/ConstrainedConjugateGradient.h | |
parent | 009c38df5303f0a32eed2962650b89ebd6ae2e46 (diff) |
Cleanup: trailing space
Remove from blender/nodes, collada, blenfont & render.
Diffstat (limited to 'source/blender/physics/intern/ConstrainedConjugateGradient.h')
-rw-r--r-- | source/blender/physics/intern/ConstrainedConjugateGradient.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/physics/intern/ConstrainedConjugateGradient.h b/source/blender/physics/intern/ConstrainedConjugateGradient.h index f9c6931fe8c..2d5fb41cc73 100644 --- a/source/blender/physics/intern/ConstrainedConjugateGradient.h +++ b/source/blender/physics/intern/ConstrainedConjugateGradient.h @@ -4,7 +4,7 @@ #include <Eigen/Core> -namespace Eigen { +namespace Eigen { namespace internal { @@ -29,16 +29,16 @@ void constrained_conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& typedef typename Dest::RealScalar RealScalar; typedef typename Dest::Scalar Scalar; typedef Matrix<Scalar,Dynamic,1> VectorType; - + RealScalar tol = tol_error; int maxIters = iters; - + int n = mat.cols(); VectorType residual = filter * (rhs - mat * x); //initial residual RealScalar rhsNorm2 = (filter * rhs).squaredNorm(); - if(rhsNorm2 == 0) + if(rhsNorm2 == 0) { /* XXX TODO set constrained result here */ x.setZero(); @@ -54,7 +54,7 @@ void constrained_conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& tol_error = sqrt(residualNorm2 / rhsNorm2); return; } - + VectorType p(n); p = filter * precond.solve(residual); //initial search direction @@ -68,11 +68,11 @@ void constrained_conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& 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" RealScalar absOld = absNew; @@ -95,20 +95,20 @@ struct MatrixFilter m_cmat(NULL) { } - + MatrixFilter(const MatrixType &cmat) : m_cmat(&cmat) { } - + void setMatrix(const MatrixType &cmat) { m_cmat = &cmat; } - + template <typename VectorType> void apply(VectorType v) const { v = (*m_cmat) * v; } - + protected: const MatrixType *m_cmat; }; @@ -145,7 +145,7 @@ struct traits<ConstrainedConjugateGradient<_MatrixType,_UpLo,_FilterMatrixType,_ * The maximal number of iterations and tolerance value can be controlled via the setMaxIterations() * and setTolerance() methods. The defaults are the size of the problem for the maximal number of iterations * and NumTraits<Scalar>::epsilon() for the tolerance. - * + * * This class can be used as the direct solver classes. Here is a typical usage example: * \code * int n = 10000; @@ -160,7 +160,7 @@ struct traits<ConstrainedConjugateGradient<_MatrixType,_UpLo,_FilterMatrixType,_ * // update b, and solve again * x = cg.solve(b); * \endcode - * + * * By default the iterations start with x=0 as an initial guess of the solution. * One can control the start using the solveWithGuess() method. Here is a step by * step execution example starting with a random guess and printing the evolution @@ -176,7 +176,7 @@ struct traits<ConstrainedConjugateGradient<_MatrixType,_UpLo,_FilterMatrixType,_ * } while (cg.info()!=Success && i<100); * \endcode * Note that such a step by step excution is slightly slower. - * + * * \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner */ template< typename _MatrixType, int _UpLo, typename _FilterMatrixType, typename _Preconditioner> @@ -206,10 +206,10 @@ public: ConstrainedConjugateGradient() : Base() {} /** Initialize the solver with matrix \a A for further \c Ax=b solving. - * + * * This constructor is a shortcut for the default constructor followed * by a call to compute(). - * + * * \warning this class stores a reference to the matrix A as well as some * precomputed values that depend on it. Therefore, if \a A is changed * this class becomes invalid. Call compute() to update it with the new @@ -258,7 +258,7 @@ public: m_isInitialized = true; m_info = m_error <= Base::m_tolerance ? Success : NoConvergence; } - + /** \internal */ template<typename Rhs,typename Dest> void _solve(const Rhs& b, Dest& x) const |