Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

pymrm.numjac

Back to modules overview

Numerical Jacobian construction with sparse stencil support.

View module source on GitHub

Public API

SymbolTypeSummary
NumJacclassNumerical Jacobian evaluator based on grouped finite differences.
stencil_block_diagonalsfunctionGenerate a block-diagonal or block-banded stencil description.

NumJac(shape = None, shape_in = None, shape_out = None, stencil = stencil_block_diagonals, eps_jac = 1e-06, format = 'csc', **kwargs)

Open dedicated reference page

Numerical Jacobian evaluator based on grouped finite differences.

The class builds a sparse Jacobian structure from a stencil/dependency description and reuses that structure across repeated evaluations.

View source on GitHub

Members

__init__(shape = None, shape_in = None, shape_out = None, stencil = stencil_block_diagonals, eps_jac = 1e-06, format = 'csc', **kwargs)

Create a Jacobian approximator.

Parameters

View source on GitHub

__call__(f, c, f_value = None)

Compute the numerical Jacobian for a given function and input array.

Parameters

Returns

View source on GitHub

init_stencil(stencil, **kwargs)

Initialize and process the stencil (dependency pattern) for numerical Jacobian computation.

This method configures the sparsity/dependency structure used to compute numerical Jacobians, supporting a variety of stencil specifications. The stencil can be supplied as either:

The stencil is expanded using PyMRM’s dependency notation, which allows concise or explicit description of dependencies between positions in multidimensional fields. The result is used to generate the internal sparsity pattern for efficient Jacobian assembly.

Parameters

Raises

Side Effects

Sets the following attributes on the class:

References

For a full description of the PyMRM dependency notation, see:

View source on GitHub

stencil_block_diagonals(ndims = 1, axes_diagonals = [], axes_blocks = [-1], periodic_axes = [])

Open dedicated reference page

Generate a block-diagonal or block-banded stencil description.

Parameters

Returns

View source on GitHub