Python objects & constants

Enums

Pauli(value)

See custatevecPauli_t.

MatrixLayout(value)

See custatevecMatrixLayout_t.

MatrixType(value)

See custatevecMatrixType_t.

Collapse(value)

See custatevecCollapseOp_t.

SamplerOutput(value)

See custatevecSamplerOutput_t.

DeviceNetworkType(value)

See custatevecDeviceNetworkType_t.

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.

Logger API

logger_set_callback_data(callback, *args, ...)

Set the logger callback along with arguments.

logger_open_file(filename)

Set the filename for the logger to write to.

logger_set_level(int level)

Set the logging level.

logger_set_mask(int mask)

Set the logging mask.

logger_force_disable()

Disable the logger.

Memory Management API

set_device_mem_handler(intptr_t handle, handler)

Set the device memory handler for cuTensorNet.

get_device_mem_handler(intptr_t handle)

Get the device memory handler for cuTensorNet.

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_get_workspace_size(...)

Computes the required workspace size for apply_matrix().

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

Apply the specified gate matrix.

Pauli Matrices

apply_pauli_rotation(intptr_t handle, ...)

Apply the exponential of a multi-qubit Pauli operator.

Generalized Permutation Matrices

apply_generalized_permutation_matrix_get_workspace_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.

batch_measure_with_offset(intptr_t handle, ...)

Performs measurement (on a partial statevector) of arbitrary number of single qubits.

Expectation

Expectation via a Matrix

compute_expectation_get_workspace_size(...)

Computes the required workspace size for compute_expectation().

compute_expectation(intptr_t handle, ...)

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

Expectation on Pauli Basis

compute_expectations_on_pauli_basis(...)

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.

sampler_get_squared_norm(intptr_t handle, ...)

Get the squared norm of the statevetor.

sampler_apply_sub_sv_offset(intptr_t handle, ...)

Apply the partial norm and norm to the statevector.

Accessor

accessor_create(intptr_t handle, ...)

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

accessor_create_view(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.

Qubit reordering

swap_index_bits(intptr_t handle, ...)

Swap index bits and reorder statevector elements on the device.

multi_device_swap_index_bits(handles, ...)

Swap index bits and reorder statevector elements on multiple devices.

Test gate matrix type

test_matrix_type_get_workspace_size(...)

Computes the required workspace size for test_matrix_type().

test_matrix_type(intptr_t handle, ...)

Test the deviation of a given matrix from a certain matrix type (Hermitian or unitary).