Solution¤
lineax.Solution
¤
The solution to a linear 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 vialineax.RESULTS[result]
.stats
: Statistics about the solver, e.g. the number of steps that were required.state
: The internal state of the solver. The meaning of this is specific to each solver.
lineax.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
.