derivkit.derivatives.finite.stencil module#

Stencil definitions and utilities for finite-difference derivative calculations.

derivkit.derivatives.finite.stencil.get_finite_difference_tables(stepsize: float) tuple[dict[int, list[int]], dict[tuple[int, int], ndarray]]#

Returns the offset patterns and coefficient tables.

Parameters:

stepsize – Stepsize for finite difference calculation.

Returns:

A tuple of two dictionaries. The first maps from stencil size to symmetric offsets. The second maps from (stencil_size, order) to coefficient arrays.

derivkit.derivatives.finite.stencil.validate_supported_combo(num_points: int, order: int) None#

Validates that the (stencil size, order) combo is supported.

Parameters:
  • num_points – Number of points in the finite difference stencil.

  • order – The order of the derivative to compute.

Raises:

ValueError – If the combination of num_points and order is not supported.