27#include "neml2/tensors/Tensor.h"
28#include "neml2/base/OptionSet.h"
65 template <
bool scaled>
87 template <
bool scaled>
109 template <
bool scaled>
169 virtual
void init_scaling(const
Sol<false> & x, const
bool verbose = false);
189 template <
bool scaled>
192 template <
bool scaled>
195 template <
bool scaled>
198 template <
bool scaled>
201 template <
bool scaled>
204 template <
bool scaled>
235 void ensure_scaling_matrices_initialized_dbg() const;
242template <
bool scaled>
248 if constexpr (scaled)
254template <
bool scaled>
262template <
bool scaled>
268 if constexpr (scaled)
274template <
bool scaled>
282template <
bool scaled>
289 if constexpr (scaled)
295template <
bool scaled>
Tensor _row_scaling
Row scaling "matrix" – since it's a batched diagonal matrix, we are only storing its diagonals.
Definition NonlinearSystem.h:229
static void disable_automatic_scaling(OptionSet &options)
Definition NonlinearSystem.cxx:76
Res< false > unscale(const Res< true > &r) const
Remove scaling to the residual.
Definition NonlinearSystem.cxx:175
Res< true > scale(const Res< false > &r) const
Apply scaling to the residual.
Definition NonlinearSystem.cxx:165
virtual void assemble(Res< false > *r, Jac< false > *J)=0
Compute the unscaled residual and Jacobian.
static void enable_automatic_scaling(OptionSet &options)
Definition NonlinearSystem.cxx:84
Jac< scaled > Jacobian()
Assemble and return the Jacobian.
Definition NonlinearSystem.h:264
NonlinearSystem(const NonlinearSystem &)=default
void set_guess(const Sol< true > &x)
Set the current guess.
Definition NonlinearSystem.cxx:226
NonlinearSystem(NonlinearSystem &&) noexcept=default
Tensor _col_scaling
Column scaling "matrix" – since it's a batched diagonal matrix, we are only storing its diagonals.
Definition NonlinearSystem.h:232
const bool _autoscale
If true, do automatic scaling.
Definition NonlinearSystem.h:217
const unsigned int _autoscale_miter
Maximum number of iterations allowed for the iterative automatic scaling algorithm.
Definition NonlinearSystem.h:223
Res< scaled > residual()
Assemble and return the residual.
Definition NonlinearSystem.h:244
static OptionSet expected_options()
Definition NonlinearSystem.cxx:53
const Real _autoscale_tol
Tolerance for convergence check of the iterative automatic scaling algorithm.
Definition NonlinearSystem.h:220
virtual void init_scaling(const Sol< false > &x, const bool verbose=false)
Compute algebraic Jacobian-based automatic scaling following https://cs.stanford.edu/people/paulliu/f...
Definition NonlinearSystem.cxx:99
bool _scaling_matrices_initialized
Flag to indicate whether scaling matrices have been computed.
Definition NonlinearSystem.h:226
std::tuple< Res< scaled >, Jac< scaled > > residual_and_Jacobian()
Assemble and return the residual and Jacobian.
Definition NonlinearSystem.h:284
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:52
Tensor()=default
Special member functions.
Definition DiagnosticsInterface.cxx:30
double Real
Definition types.h:68
bool & currently_solving_nonlinear_system()
Definition NonlinearSystem.cxx:35
Definition NonlinearSystem.h:89
Jac(const Jac<!scaled > &J)
Conversion between scaled and unscaled must be explicit.
Definition NonlinearSystem.h:99
Jac(const Tensor &J)
Conversion from Tensor must be explicit.
Definition NonlinearSystem.h:93
Definition NonlinearSystem.h:67
Res(const Tensor &r)
Conversion from Tensor must be explicit.
Definition NonlinearSystem.h:71
Res(const Res<!scaled > &r)
Conversion between scaled and unscaled must be explicit.
Definition NonlinearSystem.h:77
Definition NonlinearSystem.h:111
Sol(const Tensor &u)
Conversion from Tensor must be explicit.
Definition NonlinearSystem.h:115
Sol(const Sol<!scaled > &u)
Conversion between scaled and unscaled must be explicit.
Definition NonlinearSystem.h:121
SolvingNonlinearSystem(const SolvingNonlinearSystem &)=delete
SolvingNonlinearSystem & operator=(SolvingNonlinearSystem &&)=delete
SolvingNonlinearSystem & operator=(const SolvingNonlinearSystem &)=delete
SolvingNonlinearSystem(SolvingNonlinearSystem &&)=delete
~SolvingNonlinearSystem()
Definition NonlinearSystem.cxx:47
const bool prev_bool
Definition NonlinearSystem.h:51
SolvingNonlinearSystem(bool solving=true)
Definition NonlinearSystem.cxx:41