SecantSolver¶
- class hoomd.tune.SecantSolver(gamma=0.9, tol=1e-05)¶
Bases:
RootSolver
Solves equations of f(x) = y using the secant method.
The solver updates
x
each step via,\[x_n = x - \gamma \cdot (y - t) \cdot \frac{x - x_{o}}{y - y_{old}}\]where \(o\) represent the old values, \(n\) the new, and \(t\) the target. Due to the need for a previous value, then first time this is called it makes a slight jump higher or lower to start the method.
The solver will stop updating when \(\lvert y - t \rvert \le tol\).
- Parameters:
gamma (
float
, optional) – real number between 0 and 1 used to dampen the rate of change in x.gamma
scales the corrections to x each iteration. Larger values ofgamma
lead to larger changes while agamma
of 0 leads to no change in x at all.tol (
float
, optional) – The absolute tolerance for convergence of y, defaults to 1e-5.
Note
Tempering the solver with a smaller than 1
gamma
value is crucial for numeric stability. If instability is found, then loweringgamma
accordingly should help.- __eq__(other)¶
Test for equality.
- reset()¶
Reset all solving internals.
- solve_one(tunable)¶
Solve one step.