gemseo / utils / derivatives

Show inherited members

gradient_approximator_factory module

Factory for classes derived from GradientApproximator.

class gemseo.utils.derivatives.gradient_approximator_factory.GradientApproximatorFactory[source]

Bases: BaseFactory

A factory to create gradient approximators.

In addition to the names of the classes, the factory can be queried with an ApproximationMode.

Return type:

Any

create(name, f_pointer, step=None, design_space=None, normalize=True, parallel=False, **parallel_args)[source]

Create a gradient approximator.

Parameters:
  • name (str | ApproximationMode) – The name of the class or the approximation mode.

  • f_pointer (Callable) – The pointer to the function to derive.

  • step (float | complex | ndarray | None) – The default differentiation step.

  • design_space (DesignSpace | None) – The design space containing the upper bounds of the input variables. If None, consider that the input variables are unbounded.

  • normalize (bool) –

    Whether to normalize the function.

    By default it is set to True.

  • parallel (bool) –

    Whether to differentiate the function in parallel.

    By default it is set to False.

  • **parallel_args (Any) – The parallel execution options, see gemseo.core.parallel_execution.

Returns:

The gradient approximator.

Raises:

TypeError – If the class cannot be instantiated.

Return type:

GradientApproximator

failed_imports: dict[str, str]

The class names bound to the import errors.

property gradient_approximators: list[str]

The gradient approximators.