API

Collection of complex-step safe functions to replace standard Numpy operations. Parts are adapted from https://github.com/OpenMDAO/OpenMDAO/blob/master/openmdao/utils/cs_safe.py

complexify.cs.abs(x)[source]

complex-step safe version of numpy.abs function.

Parameters:
xndarray

array value to be computed on

Returns:
ndarray
complexify.cs.arctan2(y, x)[source]

Numpy-compatible, complex-compatible arctan2 function for use with complex-step.

Parameters:
yfloat or complex

The length of the side opposite the angle being determined.

xfloat or complex

The length of the side adjacent to the angle being determined.

Returns:
ndarray

The angle whose opposite side has length y and whose adjacent side has length x.

complexify.cs.mean_std(x)[source]

A function to compute mean and standard deviation of a numpy array.

Parameters:
xndarray

The array of sampled values

Returns:
mean

The mean value of the input array

stdev

The standard deviation of the input array

complexify.cs.norm(x, axis=None)[source]

complex-step safe version of numpy.linalg.norm function.

Parameters:
xndarray

array value to be computed on

axisNone or int

axis to perform the norm up to

Returns:
ndarray
complexify.cs.std(x)[source]

A function to compute the standard deviation of a numpy array.

Parameters:
xndarray

The array of sampled values

Returns:
stdev

The standard deviation of the input array