qilisdk.backends.cuda_backend

Attributes

TBasicGate

BasicGateHandlersMapping

TPauliOperator

PauliOperatorHandlersMapping

Classes

CudaSamplingMethod

Enumeration of available simulation methods for the CUDA backend.

CudaBackend

Backend implementation using CUDA-based simulation.

Functions

reverse_bits(→ int)

Reverse the lowest n bits of integer x.

cudaq_to_standard(→ numpy.ndarray)

Convert a CUDA-Q style statevector to the more common qubit-ordering

Module Contents

TBasicGate[font]
BasicGateHandlersMapping[font]
TPauliOperator[font]
type PauliOperatorHandlersMapping = dict[Type[TPauliOperator], Callable[[TPauliOperator], ElementaryOperator]][font]
reverse_bits(x: int, n: int) int[font]

Reverse the lowest n bits of integer x.

Retorna:

x with the lowest n bit reversed.

Tipus de retorn:

int

cudaq_to_standard(statevector: numpy.ndarray) numpy.ndarray[font]

Convert a CUDA-Q style statevector to the more common qubit-ordering convention where [0,1,0,0] corresponds to \(|01>\) for 2 qubits.

Paràmetres:

statevector – 1D array-like of length 2^n

Retorna:

reordered statevector

Tipus de retorn:

np.ndarray

Llença:

ValueError – if the statevector is not a 1D array or the length is not a power of 2.

class CudaSamplingMethod[font]

Bases: str, enum.Enum

Enumeration of available simulation methods for the CUDA backend.

Initialize self. See help(type(self)) for accurate signature.

STATE_VECTOR = 'state_vector'[font]
TENSOR_NETWORK = 'tensor_network'[font]
MATRIX_PRODUCT_STATE = 'matrix_product_state'[font]
class CudaBackend(sampling_method: CudaSamplingMethod = CudaSamplingMethod.STATE_VECTOR, noise_model: qilisdk.noise.NoiseModel | None = None)[font]

Bases: qilisdk.backends.backend.Backend

Backend implementation using CUDA-based simulation.

This backend translates a quantum circuit into a CUDA-compatible kernel and executes it using the cudaq library. It supports different simulation methods including state vector, tensor network, and matrix product state simulations. Gate operations in the circuit are mapped to CUDA operations via dedicated handler functions.

Initialize the CudaBackend.

Paràmetres:
  • sampling_method (CudaSamplingMethod) – The simulation method to use for sampling circuits. Options include STATE_VECTOR, TENSOR_NETWORK, or MATRIX_PRODUCT_STATE. Defaults to CudaSamplingMethod.STATE_VECTOR.

  • noise_model (NoiseModel | None) – Optional noise model applied during execution. Defaults to None.

property sampling_method: CudaSamplingMethod[font]

Return the simulation method currently configured for the backend.

Retorna:

The simulation method used for circuit

execution.

Tipus de retorn:

CudaSamplingMethod