cs_safe.py#
collection of complex-step safe functions to replace standard numpy operations.
- openmdao.utils.cs_safe.abs(x)[source]
Complex-step safe version of numpy.abs function.
- Parameters:
- xndarray
Array value to be computed on.
- Returns:
- ndarray
Absolute value.
- openmdao.utils.cs_safe.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.
- openmdao.utils.cs_safe.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
Matrix or vector norm.