cuquantum.bindings.cudensitymat.create_elementary_operator_batch¶
- cuquantum.bindings.cudensitymat.create_elementary_operator_batch(intptr_t handle, int32_t num_space_modes, space_mode_extents, int64_t batch_size, int sparsity, int32_t num_diagonals, diagonal_offsets, int data_type, intptr_t tensor_data, tensor_callback, tensor_gradient_callback) intptr_t [source]¶
Creates a batch of elementary tensor operators acting on a given number of quantum state modes (aka space modes). This is a batched version of the
cudensitymatCreateElementaryOperator
API function.- 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
.
batch_size (int64_t) – Batch size (>= 1).
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).
diagonal_offsets (object) –
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, where all elementary tensor operators within the batch are stored contiguously in memory.
tensor_callback (object) – Optional user-defined batched tensor callback function which can be called later to fill in the tensor elements in the provided batched storage, or NULL. Note that the provided batched tensor callback function is expected to fill in all tensor instances within the batch in one call.
tensor_gradient_callback (object) – Optional user-defined batched tensor gradient callback function which can be called later to compute the Vector-Jacobian Product (VJP) for the batched tensor operator, to produce gradients with respect to the batched user-defined real parameters, or NULL.
- Returns
Batched elementary tensor operator (a batch of individual elementary tensor operators stored contiguously in memory).
- Return type
intptr_t