LocalDenseMatrixOperator#

class cuquantum.densitymat.LocalDenseMatrixOperator(data, callback=None)[source]#

Dense matrix operator stored fully on a single device.

Parameters:
  • data – Data buffer for operator elements on GPU. Required to be fortran-contiguousand of shape (*hilbert_space_dims, *hilbert_space_dims, batch_size) with hilbert_space_dims a tuple of local Hilbert space dimensions defining the full Hilbert space, and batch_size an integer (for batch=size=1 the last dimension may be ommitted.)

  • callback – An optional inplace callback function that modifies GPU buffer.

Methods

__init__(
data: ndarray,
callback: GPUCallback | None = None,
) None[source]#

Initialize a matrix operator.

to_array(
t: float | None = None,
args: ndarray | None = None,
device: str | int | None = None,
) ndarray[source]#

Return the array form of the local dense matrix operator.

Parameters:
  • t – Time variable in callback, only required if callback is not None.

  • args – Additional arguments in callback, only required if callback is not None.

  • device – Device on which to return the array. Defaults to "cpu".

Attributes

data#

Data buffer of the matrix operator.

device_id#

Return device ID if stored on GPU and None if stored on CPU.

has_gradient#