# complex_step.py¶

Complex Step derivative approximations.

class openmdao.approximation_schemes.complex_step.ComplexStep[source]

Approximation scheme using complex step to calculate derivatives.

For example, using a step size of ‘h’ will approximate the derivative in the following way:

$f'(x) = \Im{\frac{f(x+ih)}{h}}.$
DEFAULT_OPTIONS = {'directional': False, 'step': 1e-40}
__init__()[source]

Initialize the ApproximationScheme.

add_approximation(abs_key, system, kwargs, vector=None)[source]

Use this approximation scheme to approximate the derivative d(of)/d(wrt).

Parameters
abs_keytuple(str,str)

Absolute name pairing of (of, wrt) for the derivative.

systemSystem

Containing System.

vectorndarray or None

Direction for difference when using directional derivatives.

kwargsdict

Additional keyword arguments, to be interpreted by sub-classes.

apply_directional(data, direction)[source]

Apply stepsize to direction and embed into approximation data.

Parameters
datafloat

Step size for complex step.

directionndarray

Vector containing derivative direction.

Returns
ndarray

New step direction.

compute_approximations(system, jac, total=False)[source]

Execute the system to compute the approximate sub-Jacobians.

Parameters
systemSystem

System on which the execution is run.

jacdict-like

Approximations are stored in the given dict-like object.

totalbool

If True total derivatives are being approximated, else partials.