diff --git a/NumLib/ODESolver/NonlinearSolver-impl.h b/NumLib/ODESolver/NonlinearSolver-impl.h index 96d8f9f87ef7f1e7b831f5f563fce00a13491f14..93283f8533736a9d81fd53d4e6e2c87ca1175176 100644 --- a/NumLib/ODESolver/NonlinearSolver-impl.h +++ b/NumLib/ODESolver/NonlinearSolver-impl.h @@ -101,7 +101,10 @@ solve(NonlinearSystem<Matrix, Vector, NonlinearSolverTag::Newton> &sys, Vector & bool success = false; - // TODO init _minus_delta_x to right size and 0.0 + // TODO be more efficient + // init _minus_delta_x to the right size and 0.0 + BLAS::copy(x, _minus_delta_x); + _minus_delta_x.setZero(); for (unsigned iteration=1; iteration<_maxiter; ++iteration) { @@ -110,7 +113,7 @@ solve(NonlinearSystem<Matrix, Vector, NonlinearSolverTag::Newton> &sys, Vector & // std::cout << " res:\n" << res << std::endl; - // TODO streamline the, make consistent with Picard. + // TODO streamline that, make consistent with Picard. if (norm(_res) < _tol) { success = true; break; @@ -118,7 +121,6 @@ solve(NonlinearSystem<Matrix, Vector, NonlinearSolverTag::Newton> &sys, Vector & sys.assembleJacobian(x); sys.getJacobian(_J); - // TODO _minus_delta_x might not have been initialized sys.applyKnownComponentsNewton(_J, _res, _minus_delta_x); // std::cout << " J:\n" << Eigen::MatrixXd(J) << std::endl; diff --git a/NumLib/ODESolver/NonlinearSolver.h b/NumLib/ODESolver/NonlinearSolver.h index 896e8d44107b6b77978725e84b1111b4a0aa1977..0077fc3cf8f8bc95339cc107749c4115c6dfa69f 100644 --- a/NumLib/ODESolver/NonlinearSolver.h +++ b/NumLib/ODESolver/NonlinearSolver.h @@ -84,7 +84,7 @@ private: Matrix _J; //!< The Jacobian of the residual. Vector _minus_delta_x; //!< The Newton-Raphson method solves the linearized equation //!< \f$ J \cdot (-\Delta x) = r \f$ repeatedly. - double const _alpha = 1; //!< damping factor + double const _alpha = 1; //!< Damping factor. \todo Add constructor parameter. };