cubie.outputhandling.save_state

CUDA device function factory for saving state and observable values.

This module provides a factory function that generates CUDA device functions for saving current state and observable values to output arrays during integration.

Functions

save_state_factory(saved_state_indices, ...)

Factory function for creating CUDA device functions to save state data.

cubie.outputhandling.save_state.save_state_factory(saved_state_indices: Sequence[int] | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], saved_observable_indices: Sequence[int] | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], save_state: bool, save_observables: bool, save_time: bool)[source]

Factory function for creating CUDA device functions to save state data.

This factory generates CUDA device functions that save current state and observable values to output arrays, with optional time saving. The generated function is specialized for the provided indices and flags.

Parameters:
  • saved_state_indices (Sequence[int] or ArrayLike) – Indices of state variables to save in the output.

  • saved_observable_indices (Sequence[int] or ArrayLike) – Indices of observable variables to save in the output.

  • save_state (bool) – Whether to save state variables.

  • save_observables (bool) – Whether to save observable variables.

  • save_time (bool) – Whether to append time values to the state output.

Returns:

Compiled CUDA device function for saving state data.

Return type:

Callable

Notes

The generated function takes arguments (current_state, current_observables, output_states_slice, output_observables_slice, current_step) and modifies the output slices in-place. If save_time is True, the current step is appended to the state output after the state variables.