Skip to content

Commit

Permalink
Demonstrate local simulation in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Dumazert committed Sep 10, 2023
1 parent 59bcb6b commit b64ecb2
Showing 1 changed file with 60 additions and 2 deletions.
62 changes: 60 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pip install qiskit-alice-bob-provider
`pip` will handle installing all the python dependencies automatically and you
will always install the latest (and well-tested) version.

## Use your Alice & Bob API key
## Remote execution on Alice & Bob QPUs: use your API key

To obtain an API key, please [contact Alice & Bob](https://alice-bob.com/contact/).

Expand All @@ -29,7 +29,7 @@ Where `MY_API_KEY` is your API key to the Alice & Bob API.

```python
print(ab.backends())
backend = ab.get_backend('SINGLE_CAT_SIMULATOR')
backend = ab.get_backend('SINGLE_CAT')
```

The backend can then be used like a regular Qiskit backend:
Expand All @@ -45,3 +45,61 @@ job = execute(c, backend)
res = job.result()
print(res.get_counts())
```

## Local simulation of cat quit processors

This project contains multiple simulators of multi cat qubit processors.

```python
from qiskit_alice_bob_provider import AliceBobLocalProvider
from qiskit import QuantumCircuit, execute, transpile

provider = AliceBobLocalProvider()
print(provider.backends())
# PHYSICAL_CATS_6, PHYSICAL_CATS_40, LESCANNE_2020
```

The `PHYSICAL_CATS` backends are theoretical models of quantum processors made
up of physical cat qubits.
They can be used to study the properties of error correction codes implemented
with physical cat qubits, for different hardware performance levels
(see the parameters of class `PhysicalCatProcessor`).

The `LESCANNE_2020` backend is an interpolated model simulating the processor
used in the [seminal paper](https://arxiv.org/pdf/1907.11729.pdf) by Raphaël
Lescanne in 2020.
This interpolated model is configured to act as a digital twin of the cat qubit
used in this paper.
It does not represent the current performance of Alice & Bob's cat qubits.

The example below schedules and simulates a Bell state preparation circuit on
a `PHYSICAL_CATS_6` processor, for different values of parameters `alpha` and
`kappa_2`.

```python
from qiskit_alice_bob_provider import AliceBobLocalProvider
from qiskit import QuantumCircuit, execute, transpile

provider = AliceBobLocalProvider()

circ = QuantumCircuit(2, 2)
circ.initialize('0+')
circ.cx(0, 1)
circ.measure(0, 0)
circ.measure(1, 1)

# Default 6-qubit QPU with the ratio of memory dissipation rates set to
# k1/k2=1e-5 and cat amplitude alpha set to 4.
backend = provider.get_backend('PHYSICAL_CATS_6')

print(transpile(circ, backend).draw())
# *Displays a timed and scheduled circuit*

print(execute(circ, backend, shots=100000).result().get_counts())
# {'11': 49823, '00': 50177}

# Changing the cat amplitude from 4 (default) to 2 and k1/k2 to 1e-2.
backend = provider.get_backend('PHYSICAL_CATS_6', alpha=2, kappa_2=1e4)
print(execute(circ, backend, shots=100000).result().get_counts())
# {'01': 557, '11': 49422, '10': 596, '00': 49425}
```

0 comments on commit b64ecb2

Please sign in to comment.