My Project
Public Member Functions | List of all members
cpu_mlp::Newton< V, M > Class Template Reference

Newton minimizer (full Newton) for unconstrained optimization. More...

#include <newton.hpp>

Inheritance diagram for cpu_mlp::Newton< V, M >:
Inheritance graph
[legend]
Collaboration diagram for cpu_mlp::Newton< V, M >:
Collaboration graph
[legend]

Public Member Functions

void setHessian (const HessFun< V, M > &hessFun) noexcept
 Sets the Hessian function for computing the second derivative matrix. More...
 
solve (V x, VecFun< V, double > &f, GradFun< V > &Gradient) override
 Solves the unconstrained optimization problem using Newton's Method. More...
 
- Public Member Functions inherited from cpu_mlp::FullBatchMinimizer< V, M >
virtual ~FullBatchMinimizer ()=default
 
virtual void setInitialHessian (const M &)
 Sets the initial Hessian approximation (if applicable). More...
 
template<auto LossFn, typename DataType >
solve_with_enzyme (V x, DataType *data)
 Helper to solve directly using an Enzyme-compatible raw function. More...
 
void setMaxIterations (int max_iters)
 Sets the maximum number of iterations. More...
 
void setMaxLineIters (int max_line)
 Sets the maximum number of iterations for the line search. More...
 
void setArmijoMaxIter (int max_armijo)
 Sets the maximum iterations for Armijo condition check (alias for setMaxLineIters). More...
 
void setTolerance (double tol)
 Sets the tolerance for convergence. More...
 
unsigned int iterations () const
 Returns the number of iterations performed. More...
 
double tolerance () const
 Returns the tolerance used. More...
 
void setRecorder (::IterationRecorder< CpuBackend > *recorder)
 Attach a recorder for loss/grad history. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cpu_mlp::FullBatchMinimizer< V, M >
double line_search (V x, V p, VecFun< V, double > &f, GradFun< V > &Gradient)
 Backtracking Line Search satisfying Wolfe Conditions. More...
 
- Protected Attributes inherited from cpu_mlp::FullBatchMinimizer< V, M >
unsigned int _max_iters = 1000
 
unsigned int _iters = 0
 
double _tol = 1e-10
 
::IterationRecorder< CpuBackend > * recorder_ = nullptr
 Optional recorder for diagnostics. More...
 
double c1 = 1e-4
 
double c2 = 0.9
 
double rho = 0.5
 
double max_line_iters = 50
 

Detailed Description

template<typename V, typename M>
class cpu_mlp::Newton< V, M >

Newton minimizer (full Newton) for unconstrained optimization.

Member Function Documentation

◆ setHessian()

template<typename V , typename M >
void cpu_mlp::Newton< V, M >::setHessian ( const HessFun< V, M > &  hessFun)
inlinevirtualnoexcept

Sets the Hessian function for computing the second derivative matrix.

Parameters
hessFunA function that takes a parameter vector and returns the Hessian matrix.

Reimplemented from cpu_mlp::FullBatchMinimizer< V, M >.

◆ solve()

template<typename V , typename M >
V cpu_mlp::Newton< V, M >::solve ( x,
VecFun< V, double > &  f,
GradFun< V > &  Gradient 
)
inlineoverridevirtual

Solves the unconstrained optimization problem using Newton's Method.

Parameters
xInitial parameter vector.
fObjective function.
GradientGradient function.
Returns
The optimized parameter vector.

Implements cpu_mlp::FullBatchMinimizer< V, M >.


The documentation for this class was generated from the following file: