NEML2 1.4.0
Loading...
Searching...
No Matches
TrustRegionSubProblem Class Reference

Detailed Description

The trust region subproblem introduced in

‍Yuan, Ya-xiang. Trust region algorithms for nonlinear equations. Hong Kong Baptist University, Department of Mathematics, 1994.

#include <TrustRegionSubProblem.h>

Inheritance diagram for TrustRegionSubProblem:

Public Member Functions

 TrustRegionSubProblem (const OptionSet &options)
 
virtual void reinit (const NonlinearSystem &system, const Scalar &delta)
 
Tensor preconditioned_direction (const Scalar &s) const
 
- Public Member Functions inherited from NonlinearSystem
 NonlinearSystem (const OptionSet &options)
 
virtual void init_scaling (const bool verbose=false)
 Compute algebraic Jacobian-based automatic scaling following https://cs.stanford.edu/people/paulliu/files/cs517-project.pdf.
 
Tensor scale_residual (const Tensor &r) const
 Apply scaling to the residual.
 
Tensor scale_Jacobian (const Tensor &J) const
 Apply scaling to the Jacobian.
 
Tensor scale_direction (const Tensor &p) const
 Remove scaling from the search direction, i.e. \( J^{-1} r \).
 
virtual void set_solution (const Tensor &x)
 Set the solution vector.
 
virtual Tensor solution () const
 Get the solution vector.
 
Tensor residual (const Tensor &x)
 Convenient shortcut to set the current solution, assemble and return the system residual.
 
void residual ()
 Convenient shortcut to assemble and return the system residual.
 
Tensor Jacobian (const Tensor &x)
 Convenient shortcut to set the current solution, assemble and return the system Jacobian.
 
void Jacobian ()
 Convenient shortcut to assemble and return the system Jacobian.
 
std::tuple< Tensor, Tensorresidual_and_Jacobian (const Tensor &x)
 Convenient shortcut to set the current solution, assemble and return the system residual and Jacobian.
 
void residual_and_Jacobian ()
 Convenient shortcut to assemble and return the system residual and Jacobian.
 
const Tensorget_residual () const
 
const Tensorget_Jacobian () const
 
Tensor residual_norm () const
 The residual norm.
 
virtual bool is_AD_enabled () const
 Whether AD is enabled.
 
virtual bool is_AD_disabled () const final
 Whether AD is disabled.
 

Protected Member Functions

virtual void assemble (bool residual, bool Jacobian) override
 Compute the residual and Jacobian.
 
Tensor preconditioned_solve (const Scalar &s, const Tensor &v) const
 

Protected Attributes

TensorShape _batch_sizes
 
torch::TensorOptions _options
 
- Protected Attributes inherited from NonlinearSystem
Size _ndof
 Number of degrees of freedom.
 
Tensor _solution
 View for the solution of this nonlinear system.
 
Tensor _residual
 View for the residual of this nonlinear system.
 
Tensor _Jacobian
 View for the Jacobian of this nonlinear system.
 
Tensor _scaled_residual
 
Tensor _scaled_Jacobian
 
const bool _autoscale
 If true, do automatic scaling.
 
const Real _autoscale_tol
 Tolerance for convergence check of the iterative automatic scaling algorithm.
 
const unsigned int _autoscale_miter
 Maximum number of iterations allowed for the iterative automatic scaling algorithm.
 
bool _scaling_matrices_initialized
 Flag to indicate whether scaling matrices have been computed.
 
Tensor _row_scaling
 Row scaling "matrix" – since it's a batched diagonal matrix, we are only storing its diagonals.
 
Tensor _col_scaling
 Column scaling "matrix" – since it's a batched diagonal matrix, we are only storing its diagonals.
 

Additional Inherited Members

- Static Public Member Functions inherited from NonlinearSystem
static OptionSet expected_options ()
 
static void disable_automatic_scaling (OptionSet &options)
 
static void enable_automatic_scaling (OptionSet &options)
 

Constructor & Destructor Documentation

◆ TrustRegionSubProblem()

Member Function Documentation

◆ assemble()

void assemble ( bool residual,
bool Jacobian )
overrideprotectedvirtual

Compute the residual and Jacobian.

Parameters
residualWhether residual is requested
JacobianWhether Jacobian is requested

Implements NonlinearSystem.

◆ preconditioned_direction()

Tensor preconditioned_direction ( const Scalar & s) const

◆ preconditioned_solve()

Tensor preconditioned_solve ( const Scalar & s,
const Tensor & v ) const
protected

◆ reinit()

void reinit ( const NonlinearSystem & system,
const Scalar & delta )
virtual

Member Data Documentation

◆ _batch_sizes

TensorShape _batch_sizes
protected

◆ _options

torch::TensorOptions _options
protected