OperatorAction#
-
class cuquantum.
densitymat. OperatorAction( - ctx,
- operators,
- scope='full',
- approach='linsolve',
- scope_config=None,
- approach_config=None,
Operator action representing the action of a set of
Operatorobjects on a set of input states, accumulated into a single output state.- Parameters:
ctx – Library context, which contains workspace, stream and other configuration information.
operators – A sequence of
Operatorobjects, the length of which is identical to the length of sequence of input states accepted when computing this instance’s action.scope – State-fitting scope. Accepts
"full","split", or acudm.StateFittingScopeKindenum value.approach – State-fitting approach. Accepts
"linsolve"or acudm.StateFittingApproachKindenum value.scope_config – Optional scope-specific configuration (
ALSConfig).approach_config – Optional approach-specific configuration (
StateFittingApproachLinSolveConfig).
Methods
- __init__(
- ctx: WorkStream,
- operators: Tuple[Operator],
- scope: str | StateFittingScopeKind = 'full',
- approach: str | StateFittingApproachKind = 'linsolve',
- scope_config: ALSConfig | None = None,
- approach_config: StateFittingApproachLinSolveConfig | None = None,
Initialize an operator action representing the action of a set of
Operatorobjects on a set of input states, accumulated into a single output state.
- compute(
- t: float,
- params: ndarray | ndarray | Sequence[float] | None,
- states_in: Sequence[State],
- state_out: State,
Compute the action of this instance on a sequence of input states and accumulate the results into an output state.
- Parameters:
t – Time argument to be passed to all callback functions.
params – Additional arguments to be passed to all callback functions. The element type is required to be float (i.e “float64” for arrays). If batched operators or coefficients are used, they need to be passed as 2-dimensional the last dimension of which is the batch size. To avoid copy of the argument array, it can be passed as a fortran-contiguous cp.ndarray.
states_in – The quantum states to which the
OperatorActionis applied.state_out – The quantum state into which the result is accumulated.
- configure(
- scope_config: ALSConfig | None = None,
- approach_config: StateFittingApproachLinSolveConfig | None = None,
Update the operator-action (state-fitting) configuration.
prepare()must be invoked before the nextcompute()call.- Parameters:
scope_config – Scope-specific configuration (
ALSConfig).approach_config – Approach-specific configuration (
StateFittingApproachLinSolveConfig).
- prepare(
- ctx: WorkStream,
- states_in: Sequence[State],
- state_out: State | None = None,
- compute_type: str | None = None,
Prepare the action of this instance on input states.
- Parameters:
ctx – Library context, which contains workspace, stream and other configuration information.
states_in – The input quantum states to which the action is to be applied.
state_out – The output quantum state to which the action is to be accumulated. Defaults to the first element of
state_in.compute_type – CUDA compute type string (e.g.
"complex128"). Defaults toctx.compute_typewhen set, otherwise to the operator’s dtype.
Attributes
- dtype#
Data type of this
OperatorAction.
- hilbert_space_dims#
Hilbert space dimension of this
OperatorAction.