CrankNicolsonStep
- class cubie.integrators.CrankNicolsonStep(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n: int, evaluate_f: Callable | None = None, evaluate_observables: Callable | None = None, evaluate_driver_at_t: Callable | None = None, get_solver_helper_fn: Callable | None = None, **kwargs)[source]
Bases:
ODEImplicitStepCrank–Nicolson step with embedded backward Euler error estimation.
- __init__(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n: int, evaluate_f: Callable | None = None, evaluate_observables: Callable | None = None, evaluate_driver_at_t: Callable | None = None, get_solver_helper_fn: Callable | None = None, **kwargs) None[source]
Initialise the Crank–Nicolson step configuration.
- Parameters:
precision – Precision applied to device buffers.
n – Number of state entries advanced per step.
evaluate_f – Device function for evaluating f(t, y) right-hand side.
evaluate_observables – Device function computing system observables.
evaluate_driver_at_t – Optional device function evaluating drivers at arbitrary times.
get_solver_helper_fn – Callable returning device helpers used by the nonlinear solver.
**kwargs – Optional parameters passed to config classes. See CrankNicolsonStepConfig, ImplicitStepConfig, and solver config classes for available parameters. None values are ignored.
- build_step(evaluate_f: Callable, evaluate_observables: Callable, evaluate_driver_at_t: Callable | None, solver_function: Callable, numba_precision: type, n: int, n_drivers: int) StepCache[source]
Build the device function for the Crank–Nicolson step.
- Parameters:
evaluate_f – Device function for evaluating f(t, y).
evaluate_observables – Device function for computing observables.
evaluate_driver_at_t – Optional device function for evaluating drivers at time t.
solver_function – Device function for the Newton-Krylov nonlinear solver.
numba_precision – Numba precision corresponding to the configured precision.
n – Dimension of the state vector.
n_drivers – Number of driver signals provided to the system.
- Returns:
Container holding the compiled step function and solver.
- Return type: