![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Shared types for specialized small-dimension Newton solvers. More...
Namespaces | |
| namespace | detail |
Data Structures | |
| struct | LMConfig |
| Configuration for Levenberg-Marquardt algorithm. Extends base Config with damping parameter settings. More... | |
| struct | NewtonBoundsN |
| Box bounds for N-dimensional solver. More... | |
| struct | NewtonOptions |
| Solver options for small-dimension Newton methods. More... | |
| struct | NewtonResultN |
| Result of N-dimensional Newton solver. More... | |
Functions | |
| template<typename FuncSetType > | |
| VectorResult | Newton (FuncSetType &theFunc, const math_Vector &theStart, const math_Vector &theTolX, double theTolF, size_t theMaxIter=100) |
| Newton-Raphson method for solving systems of nonlinear equations. | |
| template<typename FuncSetType > | |
| VectorResult | NewtonBounded (FuncSetType &theFunc, const math_Vector &theStart, const math_Vector &theInfBound, const math_Vector &theSupBound, const math_Vector &theTolX, double theTolF, size_t theMaxIter=100) |
| Newton-Raphson method with bounds constraints. | |
| template<typename FuncSetType > | |
| VectorResult | Newton (FuncSetType &theFunc, const math_Vector &theStart, double theTolX, double theTolF, size_t theMaxIter=100) |
| Simplified Newton method with uniform tolerances. | |
| template<typename Function > | |
| NewtonResultN< 2 > | Solve2D (const Function &theFunc, const std::array< double, 2 > &theX0, const NewtonBoundsN< 2 > &theBounds, const NewtonOptions &theOptions=NewtonOptions()) |
| Solve a general 2x2 nonlinear system by Newton iteration. Function contract: bool operator()(double u, double v,
double f[2], double j[2][2]) const;. | |
| template<typename Function > | |
| NewtonResultN< 2 > | Solve2DSymmetric (const Function &theFunc, const std::array< double, 2 > &theX0, const NewtonBoundsN< 2 > &theBounds, const NewtonOptions &theOptions=NewtonOptions()) |
| Solve a 2x2 system with symmetric Jacobian by robust Newton iteration. Function contract: bool ValueAndJacobian(double u, double v,
double& f1, double& f2,
double& j11, double& j12, double& j22) const; bool Value(double u, double v, double& f1, double& f2) const; // required if line search is enabled. | |
| template<typename Function > | |
| NewtonResultN< 3 > | Solve3D (const Function &theFunc, const std::array< double, 3 > &theX0, const NewtonBoundsN< 3 > &theBounds, const NewtonOptions &theOptions=NewtonOptions()) |
| Solve a 3x3 nonlinear system by Newton iteration with bounds. | |
| template<typename CurveEvaluator , typename SurfaceEvaluator > | |
| NewtonResultN< 3 > | SolveCurveSurfaceExtrema3D (const CurveEvaluator &theCurve, const SurfaceEvaluator &theSurface, const std::array< double, 3 > &theX0, const NewtonBoundsN< 3 > &theBounds, const NewtonOptions &theOptions=NewtonOptions()) |
| Optimized 3D Newton solver for curve-surface extrema. | |
| template<typename Function > | |
| NewtonResultN< 4 > | Solve4D (const Function &theFunc, const std::array< double, 4 > &theX0, const NewtonBoundsN< 4 > &theBounds, const NewtonOptions &theOptions=NewtonOptions()) |
| Solve a 4x4 nonlinear system by Newton iteration with bounds. | |
| template<typename SurfaceEvaluator1 , typename SurfaceEvaluator2 > | |
| NewtonResultN< 4 > | SolveSurfaceSurfaceExtrema4D (const SurfaceEvaluator1 &theSurf1, const SurfaceEvaluator2 &theSurf2, const std::array< double, 4 > &theX0, const NewtonBoundsN< 4 > &theBounds, const NewtonOptions &theOptions=NewtonOptions()) |
| Optimized 4D Newton solver for surface-surface extrema. | |
| template<typename FuncSetType > | |
| VectorResult | LevenbergMarquardt (FuncSetType &theFunc, const math_Vector &theStart, const LMConfig &theConfig=LMConfig()) |
| Levenberg-Marquardt algorithm for nonlinear least squares. | |
| template<typename FuncSetType > | |
| VectorResult | LevenbergMarquardtBounded (FuncSetType &theFunc, const math_Vector &theStart, const math_Vector &theInfBound, const math_Vector &theSupBound, const LMConfig &theConfig=LMConfig()) |
| Levenberg-Marquardt with bounds constraints. | |
Shared types for specialized small-dimension Newton solvers.
| VectorResult MathSys::LevenbergMarquardt | ( | FuncSetType & | theFunc, |
| const math_Vector & | theStart, | ||
| const LMConfig & | theConfig = LMConfig() ) |
Levenberg-Marquardt algorithm for nonlinear least squares.
Minimizes ||F(X)||^2 where F is a vector function of vector X. Combines Gauss-Newton method (fast near minimum) with gradient descent (robust far from minimum) using adaptive damping.
Algorithm:
| FuncSetType | type with NbVariables(), NbEquations(), Value(const math_Vector& X, math_Vector& F) and Derivatives(const math_Vector& X, math_Matrix& J) or Values(const math_Vector& X, math_Vector& F, math_Matrix& J) |
| theFunc | function set providing residuals and Jacobian |
| theStart | initial guess vector |
| theConfig | Levenberg-Marquardt configuration |
| VectorResult MathSys::LevenbergMarquardtBounded | ( | FuncSetType & | theFunc, |
| const math_Vector & | theStart, | ||
| const math_Vector & | theInfBound, | ||
| const math_Vector & | theSupBound, | ||
| const LMConfig & | theConfig = LMConfig() ) |
Levenberg-Marquardt with bounds constraints.
Minimizes ||F(X)||^2 subject to theInfBound <= X <= theSupBound. Solution is clamped to bounds after each step.
| theFunc | function set providing residuals and Jacobian |
| theStart | initial guess vector |
| theInfBound | lower bounds for solution |
| theSupBound | upper bounds for solution |
| theConfig | Levenberg-Marquardt configuration |
| VectorResult MathSys::Newton | ( | FuncSetType & | theFunc, |
| const math_Vector & | theStart, | ||
| const math_Vector & | theTolX, | ||
| double | theTolF, | ||
| size_t | theMaxIter = 100 ) |
Newton-Raphson method for solving systems of nonlinear equations.
Solves F(X) = 0 where F is a vector function of vector X. The method iteratively improves an initial guess by solving the linear system J(X)*dX = -F(X) where J is the Jacobian matrix.
| theFunc | function set with derivatives (Jacobian) |
| theStart | initial guess vector |
| theTolX | tolerance for solution change ||X(n+1) - X(n)|| < tolX |
| theTolF | tolerance for function values ||F(X)|| < tolF |
| theMaxIter | maximum number of iterations |
| VectorResult MathSys::Newton | ( | FuncSetType & | theFunc, |
| const math_Vector & | theStart, | ||
| double | theTolX, | ||
| double | theTolF, | ||
| size_t | theMaxIter = 100 ) |
Simplified Newton method with uniform tolerances.
| theFunc | function set with derivatives |
| theStart | initial guess vector |
| theTolX | uniform tolerance for all variables |
| theTolF | tolerance for function values |
| theMaxIter | maximum number of iterations |
| VectorResult MathSys::NewtonBounded | ( | FuncSetType & | theFunc, |
| const math_Vector & | theStart, | ||
| const math_Vector & | theInfBound, | ||
| const math_Vector & | theSupBound, | ||
| const math_Vector & | theTolX, | ||
| double | theTolF, | ||
| size_t | theMaxIter = 100 ) |
Newton-Raphson method with bounds constraints.
Solves F(X) = 0 subject to InfBound <= X <= SupBound. If the Newton step would take X outside bounds, the solution is clamped to the boundary.
| theFunc | function set with derivatives (Jacobian) |
| theStart | initial guess vector |
| theInfBound | lower bounds for solution |
| theSupBound | upper bounds for solution |
| theTolX | tolerance for solution change |
| theTolF | tolerance for function values |
| theMaxIter | maximum number of iterations |
| NewtonResultN< 2 > MathSys::Solve2D | ( | const Function & | theFunc, |
| const std::array< double, 2 > & | theX0, | ||
| const NewtonBoundsN< 2 > & | theBounds, | ||
| const NewtonOptions & | theOptions = NewtonOptions() ) |
Solve a general 2x2 nonlinear system by Newton iteration. Function contract: bool operator()(double u, double v, double f[2], double j[2][2]) const;.
| NewtonResultN< 2 > MathSys::Solve2DSymmetric | ( | const Function & | theFunc, |
| const std::array< double, 2 > & | theX0, | ||
| const NewtonBoundsN< 2 > & | theBounds, | ||
| const NewtonOptions & | theOptions = NewtonOptions() ) |
Solve a 2x2 system with symmetric Jacobian by robust Newton iteration. Function contract: bool ValueAndJacobian(double u, double v, double& f1, double& f2, double& j11, double& j12, double& j22) const; bool Value(double u, double v, double& f1, double& f2) const; // required if line search is enabled.
| NewtonResultN< 3 > MathSys::Solve3D | ( | const Function & | theFunc, |
| const std::array< double, 3 > & | theX0, | ||
| const NewtonBoundsN< 3 > & | theBounds, | ||
| const NewtonOptions & | theOptions = NewtonOptions() ) |
Solve a 3x3 nonlinear system by Newton iteration with bounds.
Solves the system [F1, F2, F3] = [0, 0, 0] using Newton-Raphson iteration with Cramer's rule for the 3x3 linear system at each step.
The function type must be callable with signature:
where theF is the function values and theJ is the 3x3 Jacobian matrix.
| Function | callable type (functor, lambda, or function pointer) |
| [in] | theFunc | function to solve (provides F and Jacobian) |
| [in] | theX0 | initial guess {x1, x2, x3} |
| [in] | theBounds | box bounds for each variable |
| [in] | theOptions | solver options (tolerances, max iterations, etc.) |
| NewtonResultN< 4 > MathSys::Solve4D | ( | const Function & | theFunc, |
| const std::array< double, 4 > & | theX0, | ||
| const NewtonBoundsN< 4 > & | theBounds, | ||
| const NewtonOptions & | theOptions = NewtonOptions() ) |
Solve a 4x4 nonlinear system by Newton iteration with bounds.
Solves the system [F1, F2, F3, F4] = [0, 0, 0, 0] using Newton-Raphson iteration with Gaussian elimination for the 4x4 linear system at each step.
The function type must be callable with signature:
where theF is the function values and theJ is the 4x4 Jacobian matrix.
| Function | callable type (functor, lambda, or function pointer) |
| [in] | theFunc | function to solve (provides F and Jacobian) |
| [in] | theX0 | initial guess {x1, x2, x3, x4} |
| [in] | theBounds | box bounds for each variable |
| [in] | theOptions | solver options (tolerances, max iterations, etc.) |
| NewtonResultN< 3 > MathSys::SolveCurveSurfaceExtrema3D | ( | const CurveEvaluator & | theCurve, |
| const SurfaceEvaluator & | theSurface, | ||
| const std::array< double, 3 > & | theX0, | ||
| const NewtonBoundsN< 3 > & | theBounds, | ||
| const NewtonOptions & | theOptions = NewtonOptions() ) |
Optimized 3D Newton solver for curve-surface extrema.
Specialized version for finding extrema between a curve C(t) and surface S(u,v). The function values are the gradient components of the squared distance:
| CurveEvaluator | type providing D2(t, P, D1, D2) evaluation |
| SurfaceEvaluator | type providing D2(u, v, P, D1U, D1V, D2UU, D2VV, D2UV) evaluation |
| [in] | theCurve | curve evaluator |
| [in] | theSurface | surface evaluator |
| [in] | theX0 | initial guess {t, u, v} |
| [in] | theBounds | box bounds for {t, u, v} |
| [in] | theOptions | solver options |
| NewtonResultN< 4 > MathSys::SolveSurfaceSurfaceExtrema4D | ( | const SurfaceEvaluator1 & | theSurf1, |
| const SurfaceEvaluator2 & | theSurf2, | ||
| const std::array< double, 4 > & | theX0, | ||
| const NewtonBoundsN< 4 > & | theBounds, | ||
| const NewtonOptions & | theOptions = NewtonOptions() ) |
Optimized 4D Newton solver for surface-surface extrema.
Specialized version for finding extrema between two surfaces S1(u1,v1) and S2(u2,v2). The function values are the gradient components of the squared distance:
The Jacobian has a special block structure with 2x2 blocks.
| SurfaceEvaluator1 | type providing D2 evaluation for first surface |
| SurfaceEvaluator2 | type providing D2 evaluation for second surface |
| [in] | theSurf1 | first surface evaluator |
| [in] | theSurf2 | second surface evaluator |
| [in] | theX0 | initial guess {u1, v1, u2, v2} |
| [in] | theBounds | box bounds for {u1, v1, u2, v2} |
| [in] | theOptions | solver options |