Python objects & constants

Objects

SVSwapParameters()

A wrapper class holding a set of data transfer parameters.

sv_swap_parameters_dtype

DType class corresponding to the scalar type and dtype of the same name.

Enums and constants

Pauli(value)

See custatevecPauli_t.

MatrixLayout(value)

See custatevecMatrixLayout_t.

MatrixType(value)

See custatevecMatrixType_t.

MatrixMapType(value)

See custatevecMatrixMapType_t.

Collapse(value)

See custatevecCollapseOp_t.

SamplerOutput(value)

See custatevecSamplerOutput_t.

DeviceNetworkType(value)

See custatevecDeviceNetworkType_t.

StateVectorType(value)

See custatevecStateVectorType_t.

CommunicatorType(value)

See custatevecCommunicatorType_t.

DataTransferType(value)

See custatevecDataTransferType_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.

State Vector Initialization

initialize_state_vector(intptr_t handle, ...)

Initialize the state vector.

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.

apply_matrix_batched_get_workspace_size(...)

Computes the required workspace size for apply_matrix_batched().

apply_matrix_batched(intptr_t handle, ...)

Apply the specified gate matrices to the batched statevectors.

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.

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.

abs2sum_array_batched(intptr_t handle, ...)

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

collapse_by_bitstring_batched_get_workspace_size(...)

Computes the required workspace size for collapse_by_bitstring_batched().

collapse_by_bitstring_batched(...)

Collapse the batched statevectors to the states specified by the given bit strings.

measure_batched(intptr_t handle, ...)

Performs measurement of a batched of statevectors.

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.

Single-process 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.

Multi-process qubit reordering

communicator_create(intptr_t handle, ...)

Create a cuStateVec distributed communicator.

communicator_destroy(intptr_t handle, ...)

Destory the cuStateVec distributed communicator.

dist_index_bit_swap_scheduler_create(...)

Create a cuStateVec distributed index-bit swap scheduler.

dist_index_bit_swap_scheduler_destroy(...)

Destroy the cuStateVec distributed index-bit swap scheduler.

dist_index_bit_swap_scheduler_set_index_bit_swaps(...)

Schedule the index bits to be swapped across processes.

dist_index_bit_swap_scheduler_get_parameters(...)

Get the data transfer parameters from the scheduler.

sv_swap_worker_create(intptr_t handle, ...)

Create a cuStateVec distributed statevector swap worker.

sv_swap_worker_destroy(intptr_t handle, ...)

Destroy the cuStateVec distributed statevector swap worker.

sv_swap_worker_set_extra_workspace(...)

Set the extra workspace for the distributed statevector swap worker.

sv_swap_worker_set_transfer_workspace(...)

Set the transfer workspace for the distributed statevector swap worker.

sv_swap_worker_set_sub_svs_p2p(...)

Set P2P access for the distributed sub statevectors.

sv_swap_worker_set_parameters(...)

Set data transfer parameters for the distributed sub statevector swap workers.

sv_swap_worker_execute(intptr_t handle, ...)

Execute the swapping of distributed sub statevectors.

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