rqutils.svsim module

Scalable state vector simulator

svsim is a GPU-accelerated state vector simulator implemented in JAX. The implementation focuses on gate execution speed and scalability. In practice this means:

  • Only a very limited gate set is supported. When given as a qiskit QuantumCircuit, the input circuit can only contain x, y, z, cz, rx, ry, rz, and rzz gates.

  • Using the Multi-device and Multi-controller features of JAX, circuits for large (32+) numbers of qubits can be simulated.

Usage examples can be found at examples/svsim.py.

rqutils.svsim.svsim(circuit: CircuitInput, initial_state: NDArray[complex128] | int = 0, out_sharding: NamedSharding | P | None = None) Array

Simulate the quantum circuit.

The circuit argument can be given in three formats:

  • Qiskit QuantumCircuit

  • CircuitXZ

  • A list of gate specifiers

A gate specifier is a 2-tuple (name, qubit) (for nonparametric gates) or a 3-tuple (name, qubit, angle) (rotation gates). The gate name must be one of x, y, z, cz, rx, ry, rz, or rzz.

Parameters:
  • circuit – Quantum circuit to simulate.

  • initial_state – Initial state vector or the one-hot index.

  • out_sharding – Manual specification of the sharding of the final state vector.

Returns:

Final state vector as a (sharded) JAX Array.

class rqutils.svsim.CircuitXZ(x: ndarray[tuple[int], dtype[int64]], z: ndarray[tuple[int], dtype[int64]], cos: ndarray[tuple[int], dtype[floating]], sin: ndarray[tuple[int], dtype[floating]], num_qubits: int)

Symplectic (XZ) representation of a series of rotation gates.

rqutils.svsim.to_circuitxz(circuit: CircuitInput) CircuitXZ

Translate circuit data given as a list of GateSpecs or a QuantumCircuit into signatures.