create_elementary_operator#
-
cuquantum.
bindings. cudensitymat. create_elementary_operator( - intptr_t handle,
- int32_t num_space_modes,
- space_mode_extents,
- int sparsity,
- int32_t num_diagonals,
- diagonal_offsets,
- int data_type,
- intptr_t tensor_data,
- tensor_callback,
- tensor_gradient_callback,
Creates an elementary tensor operator acting on a given number of quantum state modes (aka space modes).
- Parameters:
handle (intptr_t) – Library handle.
num_space_modes (int32_t) – Number of the (state) space modes acted on.
space_mode_extents (object) –
Extents of the (state) space modes acted on. It can be:
an
int
as the pointer address to the array, ora Python sequence of
int64_t
.
sparsity (ElementaryOperatorSparsity) – Tensor operator sparsity defining the storage scheme.
num_diagonals (int32_t) – For multi-diagonal tensor operator matrices, specifies the total number of non-zero diagonals (>= 1), otherwise ignored.
diagonal_offsets (object) –
For multi-diagonal tensor operator matrices, these are the offsets of the non-zero diagonals (for example, the main diagonal has offset 0, the diagonal right above the main diagonal has offset +1, the diagonal right below the main diagonal has offset -1, and so on). It can be:
an
int
as the pointer address to the array, ora Python sequence of
int32_t
.
data_type (int) – Tensor operator data type.
tensor_data (intptr_t) – GPU-accessible pointer to the tensor operator elements storage.
tensor_callback (object) – Optional user-defined tensor callback function which can be called later to fill in the tensor elements in the provided storage, or NULL.
tensor_gradient_callback (object) – Optional user-defined tensor gradient callback function which can be called later to compute the Vector-Jacobian Product (VJP) for the tensor operator, to produce gradients with respect to the user-defined real parameters, or NULL.
- Returns:
Elementary tensor operator.
- Return type:
intptr_t