class pyoptsparse.pyOpt_gradient.Gradient(optProb, sensType, sensStep=None, sensMode='', comm=None)[source]

Gradient class for automatically computing gradients with finite difference or complex step.

optProb : Optimization instance

This is the complete description of the optimization problem.

sensType : str

‘FD’ for forward difference, ‘CD’ for central difference, ‘FDR’ for forward difference with relative step size, ‘CDR’ for central difference with relative step size, and ‘CS’ for complex step

sensStep : number

Step size to use for differencing

sensMode : str

Flag to compute gradients in parallel.