25#include "neml2/solvers/TrustRegionSubProblem.h"
26#include "neml2/misc/math.h"
45 _R =
system.residual_view().clone();
46 _J =
system.Jacobian_view().clone();
47 _delta =
delta.clone();
BatchTensor base_transpose(TorchSize d1, TorchSize d2) const
Transpose two base dimensions.
Definition BatchTensorBase.cxx:299
Definition BatchTensor.h:32
static BatchTensor identity(TorchSize n, const torch::TensorOptions &options=default_tensor_options())
Unbatched identity tensor.
Definition BatchTensor.cxx:91
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
static Scalar empty(const torch::TensorOptions &options=default_tensor_options())
Unbatched empty tensor.
Definition FixedDimTensor.h:129
static Scalar zeros(const torch::TensorOptions &options=default_tensor_options())
Unbatched zero tensor.
Definition FixedDimTensor.h:145
Definition of a nonlinear system of equations.
Definition NonlinearSystem.h:37
BatchTensor _Jacobian
View for the Jacobian of this nonlinear system.
Definition NonlinearSystem.h:108
void residual()
Convenient shortcut to assemble and return the system residual.
Definition NonlinearSystem.cxx:175
BatchTensor _solution
View for the solution of this nonlinear system.
Definition NonlinearSystem.h:102
BatchTensor _residual
View for the residual of this nonlinear system.
Definition NonlinearSystem.h:105
void Jacobian()
Convenient shortcut to assemble and return the system Jacobian.
Definition NonlinearSystem.cxx:192
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:59
The (logical) scalar.
Definition Scalar.h:38
virtual void assemble(bool residual, bool Jacobian) override
Compute the residual and Jacobian.
Definition TrustRegionSubProblem.cxx:54
torch::TensorOptions _options
Definition TrustRegionSubProblem.h:53
BatchTensor preconditioned_solve(const Scalar &s, const BatchTensor &v) const
Definition TrustRegionSubProblem.cxx:68
TrustRegionSubProblem(const OptionSet &options)
Definition TrustRegionSubProblem.cxx:30
TorchShape _batch_sizes
Definition TrustRegionSubProblem.h:51
virtual void reinit(const NonlinearSystem &system, const Scalar &delta)
Definition TrustRegionSubProblem.cxx:36
BatchTensor preconditioned_direction(const Scalar &s) const
Definition TrustRegionSubProblem.cxx:74
BatchTensor solve(const BatchTensor &A, const BatchTensor &B)
Solve the linear system A X = B.
Definition math.cxx:340
BatchTensor bvv(const BatchTensor &a, const BatchTensor &b)
Batched vector-vector (dot) product.
Definition BatchTensor.cxx:137
BatchTensor bmv(const BatchTensor &a, const BatchTensor &v)
Batched matrix-vector product.
Definition BatchTensor.cxx:122
BatchTensor bmm(const BatchTensor &a, const BatchTensor &b)
Batched matrix-matrix product.
Definition BatchTensor.cxx:107
Derived sqrt(const Derived &a)
Definition BatchTensorBase.h:439
Derived pow(const Derived &a, const Real &n)
Definition BatchTensorBase.h:332
Definition CrossRef.cxx:32