Continuation Backends
The backends module provides the core numerical algorithms that drive the continuation process.
Base Backend
_ContinuationBackend()
Abstract base class for continuation backends.
- class hiten.algorithms.continuation.backends._ContinuationBackend[source]
Bases:
_HitenBaseBackend
- abstractmethod run(*, seed_repr, stepper, parameter_getter, corrector, representation_of, step, target, max_members, max_retries_per_step, shrink_policy, step_min, step_max)[source]
Run continuation using purely numerical inputs and callables.
- Parameters:
seed_repr (np.ndarray) – Numerical representation of the seed solution.
stepper (callable) – stepper(last_repr, step) -> (next_prediction: np.ndarray, step_hint: np.ndarray)
parameter_getter (callable) – parameter_getter(repr) -> np.ndarray of continuation parameters.
corrector (callable) – corrector(prediction_repr) -> (corrected_repr, residual_norm, converged).
representation_of (callable, optional) – Maps a domain solution to its numerical representation (for secant updates).
step (np.ndarray) – Initial step vector (m,).
target (ndarray) – Bounds array shaped (2, m): [mins; maxs].
max_members (int) – Maximum number of accepted members (including the seed).
max_retries_per_step (int) – Maximum retries allowed when correction fails at a step.
shrink_policy (callable, optional) – Function to produce a reduced step on failure.
- Returns:
family_repr (list of np.ndarray) – Accepted member representations in order (including seed as first).
info (dict) – Backend-specific telemetry (e.g., parameter history, counts, timings).
- Return type:
Predict-Correct Backend
_PCContinuationBackend()
Implement a predict-correct continuation backend.
- class hiten.algorithms.continuation.backends._PCContinuationBackend[source]
Bases:
_ContinuationBackend
Implement a predict-correct continuation backend.
This backend drives a simple predict-correct-accept loop using a user-provided predictor and corrector, adapting the step size based on success/failure and stopping when either the member limit is reached or parameters exit the configured bounds.
- Parameters:
tangent (np.ndarray | None) – The initial tangent vector.
last_residual (float) – The last residual.
- get_tangent()[source]
Return the current tangent vector maintained by the backend.
- Return type:
ndarray | None
- seed_tangent(tangent)[source]
Seed the backend with an initial tangent vector prior to
run()
.- Parameters:
tangent (ndarray | None)
- Return type:
None
- run(*, seed_repr, stepper, parameter_getter, corrector, representation_of, step, target, max_members, max_retries_per_step, shrink_policy, step_min, step_max)[source]
Run continuation using purely numerical inputs and callables.
This backend implements a simple predict-correct-accept loop using a user-provided predictor and corrector, adapting the step size based on success/failure and stopping when either the member limit is reached or parameters exit the configured bounds.
- Parameters:
seed_repr (np.ndarray) – Numerical representation of the seed solution.
stepper (Callable[[np.ndarray, np.ndarray], tuple[np.ndarray, np.ndarray]]) – Stepper function that takes the last representation and step vector and returns the next prediction and step hint.
parameter_getter (Callable[[np.ndarray], np.ndarray]) – Function that takes a representation and returns the parameter values.
corrector (Callable[[np.ndarray], tuple[np.ndarray, float, bool]]) – Function that takes a prediction and returns the corrected representation, residual norm, and convergence flag.
representation_of (Callable[[np.ndarray], np.ndarray] | None) – Function that takes a representation and returns the numerical representation.
step (np.ndarray) – Initial step vector.
target (np.ndarray, shape (2, m)) – Target parameter range.
max_members (int) – Maximum number of accepted members.
max_retries_per_step (int) – Maximum number of retries per step.
shrink_policy (Callable[[np.ndarray], np.ndarray] | None) – Function that takes a step vector and returns a shrunk step vector.
step_min (float) – Minimum step size.
step_max (float) – Maximum step size.
- Returns:
family (list of np.ndarray) – List of accepted member representations.
info (dict) – Dictionary containing the accepted count, rejected count, iterations, parameter values, and final step vector.
- Return type: