GenericRosenbrockWStep

GenericRosenbrockWStep provides a linearly implicit Rosenbrock-W integrator that requires only one Jacobian factorisation per step. The factory consumes RosenbrockTableau instances and couples user-supplied device callbacks with matrix-free linear solves from cubie.integrators.matrix_free_solvers.

Defaults

algorithm="rosenbrock" integrates with the ros3p tableau (three stages, order 3, with an embedded error estimate) under Gustafsson predictive control (step-size growth clamped to 0.2–8.0×). Rosenbrock-W methods are linearly implicit — each stage performs one linear solve rather than a Newton iteration — so of the solver settings in Default settings only the Krylov and preconditioner defaults apply; the newton_* parameters do not. Named schemes are listed on the Rosenbrock tableau registry page.

class cubie.integrators.algorithms.GenericRosenbrockWStep(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n_states: int, dxdt_fn: Callable | None = None, observables_fn: Callable | None = None, drivers_fn: Callable | None = None, driver_derivative_fn: Callable | None = None, get_solver_helper_fn: Callable | None = None, tableau: RosenbrockTableau = RosenbrockTableau(a=((0.0, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0)), b=(2.0, 0.5773502691896257, 0.42264973081037427), c=(0.0, 1.0, 1.0), order=3, b_hat=(2.113248654051871, 1.0, 0.4226497308103742), embedded_order=2, dense_prediction_ratio_float16=0.0, dense_prediction_ratio_float32=0.0, dense_prediction_ratio_float64=0.0, defaults={}, C=((0.0, 0.0, 0.0), (-1.6076951545867364, 0.0, 0.0), (-3.4641016151377553, -1.7320508075688774, 0.0)), gamma=0.7886751345948129, gamma_stages=(0.7886751345948129, -0.2113248654051871, -1.0773502691896257)), **kwargs)[source]

Bases: ODEImplicitStep

Rosenbrock-W step with an embedded error estimate.

__init__(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n_states: int, dxdt_fn: Callable | None = None, observables_fn: Callable | None = None, drivers_fn: Callable | None = None, driver_derivative_fn: Callable | None = None, get_solver_helper_fn: Callable | None = None, tableau: RosenbrockTableau = RosenbrockTableau(a=((0.0, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0)), b=(2.0, 0.5773502691896257, 0.42264973081037427), c=(0.0, 1.0, 1.0), order=3, b_hat=(2.113248654051871, 1.0, 0.4226497308103742), embedded_order=2, dense_prediction_ratio_float16=0.0, dense_prediction_ratio_float32=0.0, dense_prediction_ratio_float64=0.0, defaults={}, C=((0.0, 0.0, 0.0), (-1.6076951545867364, 0.0, 0.0), (-3.4641016151377553, -1.7320508075688774, 0.0)), gamma=0.7886751345948129, gamma_stages=(0.7886751345948129, -0.2113248654051871, -1.0773502691896257)), **kwargs) None[source]

Initialise the Rosenbrock-W step configuration.

This constructor creates a Rosenbrock-W step object and automatically selects appropriate default step controller settings based on whether the tableau has an embedded error estimate. Tableaus with error estimates default to adaptive stepping (Gustafsson controller), while errorless tableaus default to fixed stepping.

Parameters:
  • precision – Floating-point precision for CUDA computations.

  • n_states – Number of state variables in the ODE system.

  • dxdt_fn – Device function for evaluating f(t, y) right-hand side.

  • observables_fn – Device function computing system observables.

  • drivers_fn – Optional device function evaluating drivers at arbitrary times.

  • driver_derivative_fn – Optional compiled CUDA device function computing time derivatives of drivers (required for some Rosenbrock formulations).

  • get_solver_helper_fn – Factory function returning solver helper for Jacobian operations.

  • tableau – Rosenbrock tableau describing the coefficients and gamma values. Defaults to DEFAULT_ROSENBROCK_TABLEAU.

  • **kwargs – Optional parameters passed to config classes. See RosenbrockWStepConfig, ImplicitStepConfig, and solver config classes for available parameters. None values are ignored.

Notes

The step controller defaults are selected dynamically:

  • If tableau.has_error_estimate is True: Uses ROSENBROCK_ADAPTIVE_DEFAULTS (Gustafsson controller)

  • If tableau.has_error_estimate is False: Uses ROSENBROCK_FIXED_DEFAULTS (fixed-step controller)

This automatic selection prevents incompatible configurations where an adaptive controller is paired with an errorless tableau.

Rosenbrock methods linearize the ODE around the current state, avoiding the need for iterative Newton solves. This makes them efficient for moderately stiff problems. The gamma parameter from the tableau controls the implicit treatment of the linearized system.

property baked_stage_diagonal: float

Return the 1.0 the step passes at every solver call.

build_implicit_helpers() None[source]

Request the helpers and push the linear solver’s product.

build_step(dxdt_fn: Callable, observables_fn: Callable, drivers_fn: Callable | None, solver_function: Callable, numba_precision: type, n: int, n_drivers: int) StepCache[source]

Compile the Rosenbrock-W device step.

default_tableau = RosenbrockTableau(a=((0.0, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0)), b=(2.0, 0.5773502691896257, 0.42264973081037427), c=(0.0, 1.0, 1.0), order=3, b_hat=(2.113248654051871, 1.0, 0.4226497308103742), embedded_order=2, dense_prediction_ratio_float16=0.0, dense_prediction_ratio_float32=0.0, dense_prediction_ratio_float64=0.0, defaults={}, C=((0.0, 0.0, 0.0), (-1.6076951545867364, 0.0, 0.0), (-3.4641016151377553, -1.7320508075688774, 0.0)), gamma=0.7886751345948129, gamma_stages=(0.7886751345948129, -0.2113248654051871, -1.0773502691896257))

Tableau a bare family alias builds on; None for fixed schemes.

classmethod family_defaults(tableau=None) AlgorithmDefaults[source]

Adaptive or fixed defaults by the tableau’s error estimate.

property has_error_estimate: bool

Return True if the tableau supplies an error estimate.

property is_implicit: bool

Return True because the method solves linear systems.

is_linear = True

Linearly-implicit steps own their linear solver directly.

property is_multistage: bool

Return True as the method has multiple stages.

property optimisation_candidates: Tuple[Dict[str, Any], ...]

other_small unrolling, full and rolled.

property order: int

Return the classical order of accuracy.

register_buffers() None[source]

Register buffers according to locations in compile settings.

property threads_per_step: int

Return the number of CUDA threads that advance one state.

class cubie.integrators.algorithms.generic_rosenbrock_w.RosenbrockWStepConfig(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n_states: int = 1, n_drivers: int = 0, is_adaptive: bool = True, dxdt_fn: Callable | None = None, observables_fn: Callable | None = None, drivers_fn: Callable | None = None, get_solver_helper_fn: Callable | None = None, operator_beta: float = 1.0, operator_gamma: float = 1.0, preconditioner_order: int | None = None, preconditioner_type: str = 'jacobi', use_smoothed_error: bool = False, inexact_newton: bool = False, prefactored: bool = True, cached_auxiliaries_location: str = 'local', newton_nonlinear_solver_fn: Callable | None = None, krylov_linear_solver_fn: Callable | None = None, prepare_jacobian_fn: Callable | None = None, error_linear_solver_fn: Callable | None = None, helper_operation_counts: OperationCounts = NOTHING, tableau: RosenbrockTableau = RosenbrockTableau(a=((0.0, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0)), b=(2.0, 0.5773502691896257, 0.42264973081037427), c=(0.0, 1.0, 1.0), order=3, b_hat=(2.113248654051871, 1.0, 0.4226497308103742), embedded_order=2, dense_prediction_ratio_float16=0.0, dense_prediction_ratio_float32=0.0, dense_prediction_ratio_float64=0.0, defaults={}, C=((0.0, 0.0, 0.0), (-1.6076951545867364, 0.0, 0.0), (-3.4641016151377553, -1.7320508075688774, 0.0)), gamma=0.7886751345948129, gamma_stages=(0.7886751345948129, -0.2113248654051871, -1.0773502691896257)), time_derivative_fn: Callable | None = None, driver_derivative_fn: Callable | None = None, stage_rhs_location: str = 'local', stage_store_location: str = 'local', base_state_placeholder_location: str = 'local', krylov_iters_out_location: str = 'local', apply_mass_fn: Callable | None = None, *, jit_flags: JITFlags = NOTHING, unroll: UnrollFlags = NOTHING)[source]

Bases: ImplicitStepConfig

Configuration describing the Rosenbrock-W integrator.

apply_mass_fn: Callable | None
base_state_placeholder_location: str
driver_derivative_fn: Callable | None
krylov_iters_out_location: str
stage_rhs_location: str
stage_store_location: str
tableau: RosenbrockTableau
time_derivative_fn: Callable | None