sk_builder.operator_generators
Generators for linear operators.
This module implements generator functions, which return linear operators acting on states. Specifically these operators are implemented using various backends.
Currently the following backends are provided:
- generic CPU backend using numpy.
- GPU backend using cupy.
@private
Copyright © 2024-2025 HQS Quantum Simulations GmbH. All Rights Reserved.
Returns function implementing the application of the Hamiltonian.
Arguments:
- diagonal (np.ndarray): diagonal contribution to the Hamiltonian
- offdiagonals (tuple[np.ndarray, ...]): Ingredients for constructing the offdiagonal contributions to the Hamiltonian.
Returns:
Callable: Function implementing application of Hamiltonian.
Returns function implementing the application of the Hamiltonian.
Arguments:
- diagonal (np.ndarray): diagonal contribution to the Hamiltonian
- offdiagonals (tuple[np.ndarray, ...]): Ingredients for constructing the offdiagonal contributions to the Hamiltonian.
Returns:
Callable: Function implementing application of Hamiltonian.
Returns function implementing the application of the velocity operator.
Arguments:
- offdiagonals (tuple[np.ndarray, ...]): Ingredients for constructing the velocity operator.
Returns:
Callable: Function implementing application of the velocity operator.
Preparing list of off-diagonal contributions for operator implementations.
Arguments:
- offdiagonals (list[OffDiagonalContribution]): List of off-diagonal contributions.
- scale (float): Scaling factor for the operator.
- batch_size (int): Number of states in batch. Defaults to 1.
Returns:
list[ tuple[ np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray ] ]: List of scaled off-diagonal contributions for linear operator implementations.
Preparing list of off-diagonal contributions for velocity operator implementations.
Arguments:
- offdiagonals (list[OffDiagonalContribution]): List of off-diagonal contributions.
- velocity_component (Literal["x", "y", "z"]): Component of velocity for which the off-diagonal contributions are prepared.
- scale (float): Scaling factor for the operator.
- batch_size (int): Number of states in batch. Defaults to 1.
Returns:
list[ tuple[ np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, ] ]: List of scaled off-diagonal contributions for linear operator implementations.
Transforming off-diagonal contribution to batch format.
Arguments:
- contribution (OffDiagonalContribution): Off diagonal contribution to Hamiltonian.
- batch_size (int): Size of batches on which the Hamilonian operates on.
- scale (float): Scaling factor for the operator.
Returns:
tuple[ np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, ]: Tuple containing transformed off-diagonal contributions for batch format.