OutputFunctions
- class cubie.outputhandling.OutputFunctions(max_states: int, max_observables: int, precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], output_types: list[str] = None, 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] = None, 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] = None, summarised_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] = None, summarised_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] = None, sample_summaries_every: float | None = None)[source]
Bases:
CUDAFactoryFactory that compiles and caches output management functions.
- Parameters:
max_states – Maximum number of state variables in the system.
max_observables – Maximum number of observable variables in the system.
output_types – Types of output to generate. Defaults to [“state”].
saved_state_indices – Indices of state variables to save in time-domain output.
saved_observable_indices – Indices of observable variables to save in time-domain output.
summarised_state_indices – Indices of state variables to include in summary calculations.
summarised_observable_indices – Indices of observable variables to include in summary calculations.
sample_summaries_every – Time interval between summary metric samples. Used by derivative metrics to scale finite differences. Defaults to None.
precision – Numerical precision for output calculations. Defaults to np.float32.
Notes
The constructor converts the provided options into an
OutputConfiginstance and installs it as the compile settings. CUDA callables are only built once per configuration and cached bycubie.CUDAFactory.- build() OutputFunctionCache[source]
Compile output functions and calculate memory requirements.
- Returns:
Container with compiled functions that target the current configuration.
- Return type:
OutputFunctionCache
Notes
This method is invoked lazily by
cubie.CUDAFactorythe first time a compiled function is requested. The resulting cache is reused until configuration settings change.
- property compile_flags: OutputCompileFlags
Compile flags for the active configuration.
- property observable_summaries_buffer_height: int
Total height of the buffer for observable summary calculations.
- property output_array_heights: OutputArrayHeights
Output array height helper built from the active configuration.
- property saved_observable_indices: ndarray[Any, dtype[int64]]
Indices of observables saved in time-domain output.
- property saved_state_indices: ndarray[Any, dtype[int64]]
Indices of states saved in time-domain output.
- property state_summaries_buffer_height: int
Total height of the buffer for state summary calculations.
- property summarised_observable_indices: ndarray[Any, dtype[int64]]
Indices of observables tracked by summary metrics.
- property summarised_state_indices: ndarray[Any, dtype[int64]]
Indices of states tracked by summary metrics.
- property summary_legend_per_variable: dict[str, int]
Mapping of summary metric names to their per-variable heights.
- property summary_unit_modifications: dict[int, str]
Mapping of summary indices to unit modification strings.
- update(updates_dict: dict[str, object] | None = None, silent: bool = False, **kwargs: object) set[str][source]
Update compile settings through the factory interface.
- Parameters:
updates_dict – Dictionary of parameter updates to apply.
silent – When
True, suppress warnings about unrecognised parameters.**kwargs – Additional parameter updates to apply.
- Returns:
Recognised parameter names that were successfully updated.
- Return type:
- Raises:
KeyError – If unrecognised parameters are provided and
silentisFalse.
Notes
Use this method for coordinated configuration updates alongside other components by passing
silent=Trueso unrelated keys fall through without raising.