klampt.math.rootfind module

Python interface to C++ nonlinear, multidimensional root finding routines

klampt.math.rootfind.setFTolerance(tolf)[source]

Sets the termination threshold for the change in f.

Parameters

tolf (float) –

Return type

None

klampt.math.rootfind.setXTolerance(tolx)[source]

Sets the termination threshold for the change in x.

Parameters

tolx (float) –

Return type

None

klampt.math.rootfind.setVectorField(pVFObj)[source]

Sets the vector field object.

Parameters

pVFObj (object) –

Returns

0 if pVFObj = NULL, 1 otherwise.

Return type

status (int)

See vectorfield.py for an abstract base class that can be overridden to produce one of these objects.

Return type

int

klampt.math.rootfind.findRoots(startVals, iter)[source]

Performs unconstrained root finding for up to iter iterations

Parameters
  • startVals (object) –

  • iter (int) –

Returns

where status indicates

the return code, as follows:

  • 0: convergence reached in x

  • 1: convergence reached in f

  • 2: divergence

  • 3: degeneration of gradient (local extremum or saddle point)

  • 4: maximum iterations reached

  • 5: numerical error occurred

and x is the final point and n is the number of iterations used

Return type

status,x,n (tuple of int, list of floats, int)

Return type

object

klampt.math.rootfind.findRootsBounded(startVals, boundVals, iter)[source]

Same as findRoots, but with given bounds (xmin,xmax)

Parameters
  • startVals (object) –

  • boundVals (object) –

  • iter (int) –

Return type

object

klampt.math.rootfind.destroy()[source]

destroys internal data structures

Return type

None