Python functions

Library Management

Handle Management API

create()

Initialize the cuStateVec library and create a handle.

destroy(intptr_t handle)

Destroy the cuStateVec library handle.

get_default_workspace_size(intptr_t handle)

Get the default workspace size defined by cuStateVec.

set_workspace(intptr_t handle, ...)

Set the workspace to be used by cuStateVec.

CUDA Stream Management API

set_stream(intptr_t handle, intptr_t stream)

Set the stream to be used by cuStateVec.

get_stream(intptr_t handle)

Get the stream used by cuStateVec.

Versioning API

get_property(int lib_prop_type)

Get the version information of cuStateVec.

get_version()

Get the version of cuStateVec.

Gate Application

General Matrices

apply_matrix_buffer_size(intptr_t handle, ...)

Computes the required workspace size for apply_matrix().

apply_matrix(intptr_t handle, intptr_t sv, ...)

Apply the specified gate matrix.

Pauli Matrices

apply_exp(intptr_t handle, intptr_t sv, ...)

Apply the exponential of a multi-qubit Pauli operator.

Generalized Permutation Matrices

apply_generalized_permutation_matrix_buffer_size(...)

Computes the required workspace size for apply_generalized_permutation_matrix().

apply_generalized_permutation_matrix(...)

Apply a generalized permutation matrix.

Measurement

Measurement on Z-bases

abs2sum_on_z_basis(intptr_t handle, ...)

Calculates the sum of squared absolute values on a given Z product basis.

collapse_on_z_basis(intptr_t handle, ...)

Collapse the statevector on the given Z product basis.

measure_on_z_basis(intptr_t handle, ...)

Performs measurement on the given Z-product basis.

Batched Single Qubit Measurement

abs2sum_array(intptr_t handle, intptr_t sv, ...)

Calculates the sum of squared absolute values for a given set of index bits.

collapse_by_bitstring(intptr_t handle, ...)

Collapse the statevector to the state specified by the given bit string.

batch_measure(intptr_t handle, intptr_t sv, ...)

Performs measurement of arbitrary number of single qubits.

Expectation

Expectation via a Matrix

expectation_buffer_size(intptr_t handle, ...)

Computes the required workspace size for expectation().

expectation(intptr_t handle, intptr_t sv, ...)

Compute the expectation value of the given matrix with respect to the statevector.

expectations_on_pauli_basis(intptr_t handle, ...)

Compute expectation values for multiple multi-qubit Pauli strings.

Sampling

sampler_create(intptr_t handle, intptr_t sv, ...)

Create a sampler descriptor.

sampler_destroy(intptr_t sampler)

Destroy the sampler descriptor.

sampler_preprocess(intptr_t handle, ...)

Preprocess the statevector to prepare for sampling.

sampler_sample(intptr_t handle, ...)

Sample bit strings from the statevector.

Accessor

accessor_create(intptr_t handle, ...)

Create accessor to copy elements between the statevector and external buffers.

accessor_create_readonly(intptr_t handle, ...)

Create accessor to copy elements from the statevector to external buffers.

accessor_destroy(intptr_t accessor)

Destroy the accessor descriptor.

accessor_set_extra_workspace(...)

Set the external workspace to the accessor.

accessor_get(intptr_t handle, ...)

Copy elements from the statevector to an external buffer.

accessor_set(intptr_t handle, ...)

Copy elements from an external buffer to the statevector.