klampt.math.vectorfield module

Helpers to make the rootfind module more convenient and Pythonic.

class klampt.math.vectorfield.VectorFieldFunction[source]

Bases: object

A callback class used with the rootfind module to define a vector field \(f(x)=0\) to be solved for during Newton-Raphson root finding. The output is dimension m and the input is dimension n.

At the minimum, your subclass should fill out the m, n attributes, and override the eval(), and jacobian() functions. The jacobian_numeric function is provided for you in case you want to use differencing to approximate the jacobian.

eval(x)[source]
eval_i(x, i)[source]
jacobian(x)[source]
jacobian_ij(x, i, j)[source]
num_vars()[source]
num_fns()[source]
jacobian_numeric(x, delta)[source]

Helper method: returns the centered-difference jacobian approximation with stepsize delta.

class klampt.math.vectorfield.CompositeVectorFieldFunction(fns)[source]

Bases: VectorFieldFunction

A helper VectorFieldFunction that aggregates multiple VectorFieldFunctions into a stacked constraint:

0 = f1(x)
0 = f2(x)
...
0 = fn(x)
eval(x)[source]
eval_i(x, i)[source]
jacobian(x)[source]
jacobian_ij(x, i, j)[source]