Solution¤
optimistix.Solution
¤
The solution to a nonlinear solve.
Attributes:
value
: The solution to the solve.result
: An integer representing whether the solve was successful or not. This can be converted into a human-readable error message viaoptimistix.RESULTS[result]
aux
: Any user-specified auxiliary data returned from the problem; defaults toNone
if there is no auxiliary data. Auxiliary outputs can be captured by setting ahas_aux=True
flag, e.g.optx.root_find(fn, ..., has_aux=True)
.stats
: Statistics about the solve, e.g. the number of steps that were required.state
: The final internal state of the solver. The meaning of this is specific to each solver.
optimistix.RESULTS
¤
An enumeration, with the following entries:
-
successful
-
max_steps_reached
: The maximum number of solver steps was reached. Try increasingmax_steps
. -
singular
: The linear solver returned non-finite (NaN or inf) output. This usually means that the operator was not well-posed, and that the solver does not support this.If you are trying solve a linear least-squares problem then you should pass
solver=AutoLinearSolver(well_posed=False)
. By defaultlineax.linear_solve
assumes that the operator is square and nonsingular.If you were expecting this solver to work with this operator, then it may be because:
(a) the operator is singular, and your code has a bug; or
(b) the operator was nearly singular (i.e. it had a high condition number:
jnp.linalg.cond(operator.as_matrix())
is large), and the solver suffered from numerical instability issues; or(c) the operator is declared to exhibit a certain property (e.g. positive definiteness) that is does not actually satisfy.
-
breakdown
: A form of iterative breakdown has occured in the linear solve. Try using a different solver for this problem or increaserestart
if using GMRES. -
stagnation
: A stagnation in an iterative linear solve has occurred. Try increasingstagnation_iters
orrestart
. -
nonlinear_max_steps_reached
: The maximum number of steps was reached in the nonlinear solver. The problem may not be solveable (e.g., a root-find on a function that has no roots), or you may need to increasemax_steps
. -
nonlinear_divergence
: Nonlinear solve diverged.