nifty8.re.conjugate_gradient module#

class CGResults(x, nit, nfev, info, success)[source]#

Bases: NamedTuple

info: int | Array#

Alias for field number 3

nfev: int | Array#

Alias for field number 2

nit: int | Array#

Alias for field number 1

success: bool | Array#

Alias for field number 4

x: Array#

Alias for field number 0

cg(mat, j, x0=None, *args, **kwargs) Tuple[Any, int | Array][source]#

Solve mat(x) = j using Conjugate Gradient. mat must be callable and represent a hermitian, positive definite matrix.

Notes

If set, the parameters absdelta and resnorm always take precedence over tol and atol.

get_boundaries_intersections(z: Array, d: Array, trust_radius: float | Array)[source]#

Solve the scalar quadratic equation ||z + t d|| == trust_radius.

This is like a line-sphere intersection.

Return the two values of t, sorted from low to high.

second_order_approx(p: Array, cur_val: float | Array, g: Array, hessp_at_xk: Callable[[Array], Array]) float | Array[source]#
static_cg(mat, j, x0=None, *args, **kwargs)[source]#

Solve mat(x) = j using Conjugate Gradient. mat must be callable and represent a hermitian, positive definite matrix.

Notes

If set, the parameters absdelta and resnorm always take precedence over tol and atol.