Get started

Quickstart

Run your first circuit on QXel in a few minutes. QXel implements the Amazon Braket LocalSimulator interface, so you build circuits with Braket and point the simulator at the QXel backend.

1. Install QXel

Follow Installation, or install in one line if your build prerequisites are ready:

bash
pip install .

2. Build a circuit

Build a Bell state of two entangled qubits with the Braket SDK, and ask for the measurement probabilities. With QXel you attach a result type instead of adding explicit measure gates.

python
from braket.circuits import Circuit

circuit = Circuit().h(0).cnot(0, 1)
circuit.probability()

3. Run it on QXel

Create a LocalSimulator with backend="QXel-sv" and run the circuit. Set shots for a sampled run.

python
from braket.devices import LocalSimulator

qxel = LocalSimulator(backend="QXel-sv")
result = qxel.run(circuit, shots=1000).result()
print(result.measurement_counts)

Output

Counter({'00': 506, '11': 494})

The expected output is a near-even split between '00' and '11', the signature of an entangled Bell state. Counts vary because the result is sampled.

4. See what happens

Add a third entangled qubit by extending the circuit to a GHZ state, then run it again:

python
circuit = Circuit().h(0).cnot(0, 1).cnot(1, 2)
circuit.probability()
print(qxel.run(circuit, shots=1000).result().measurement_counts)

Now the counts split between '000' and '111'. To switch to GPU kernels, set compute_type="cuda" as covered in GPU acceleration.