cuquantum.densitymat.OperatorAction

class cuquantum.densitymat.OperatorAction(ctx, operators)[source]

Operator action representing the action of a set of Operator objects 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 Operator objects, the length of which is identical to the length of sequence of input states accepted when computing this instance’s action.

Methods

__init__(ctx: WorkStream, operators: Tuple[Operator])[source]

Initialize an operator action representing the action of a set of Operator objects on a set of input states, accumulated into a single output state.

compute(t: float, params: Optional[Union[numpy.ndarray, cupy.ndarray, Sequence[float]]], states_in: Sequence[State], state_out: State) None[source]

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 OperatorAction is applied.

  • state_out – The quantum state into which the result is accumulated.

prepare(ctx: WorkStream, states_in: Sequence[State], state_out: Optional[State] = None, compute_type: Optional[str] = None) None[source]

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 – The CUDA compute type to be used by the computation.

Attention

The compute_type argument is currently not used and will default to the data type.

Attributes

dtype

Data type of this OperatorAction.

hilbert_space_dims

Hilbert space dimension of this OperatorAction.