mici.autodiff module#

Automatic differentation fallback for constructing derivative functions.

mici.autodiff.autodiff_fallback(diff_func, func, diff_op_name, name)[source]#

Generate derivative function automatically if not provided.

Uses automatic differentiation to generate a function corresponding to a differential operator applied to a function if an alternative implementation of the derivative function has not been provided.

Parameters:
  • diff_func (Optional[Callable]) – Either a callable implementing the required derivative function or None if none was provided.

  • func (Callable) – Function to differentiate.

  • diff_op_name (str) – String specifying name of differential operator from automatic differentiation framework wrapper to use to generate required derivative function.

  • name (str) – Name of derivative function to use in error message.

Returns:

diff_func value if not None otherwise generated derivative of func by applying named differential operator.

Return type:

Callable