MDOFunction.check_grad: reuse enums?
For the method
argument:
def check_grad(
self,
x_vect: ArrayType,
method: str = "FirstOrderFD",
step: float = 1e-6,
error_max: float = 1e-8,
) -> None:
"""Check the gradients of the function.
Args:
x_vect: The vector at which the function is checked.
method: The method used to approximate the gradients,
either "FirstOrderFD" or "ComplexStep".
How about using this enum from derivation_modes.py
:
class ApproximationMode(StrEnum):
"""The approximation derivation modes."""
COMPLEX_STEP = "complex_step"
"""The complex step method used to approximate the Jacobians by perturbing each
variable with a small complex number."""
FINITE_DIFFERENCES = "finite_differences"
"""The finite differences method used to approximate the Jacobians by perturbing each
variable with a small real number."""
This would change the API since from "FirstOrderFD"
to "finite_differences"
and from "ComplexStep"
to "complex_step"
.