from qrisp.interface import IQMBackend
# TODO: Replace 'demo' with 'q5' or 'q50' to run on real hardware
quantum_computer = IQMBackend(
api_token=input("IQM Server API token"), server_url="https://qx.vtt.fi/demo"
)Introduction to Qrisp
This notebook demonstrates how to use Qrisp, a high-level quantum programming language, with VTT’s quantum computers.
Setup
This notebook uses the following requirements.
pip install "iqm-client>=33.0.0,<34.0.0" "qrisp[iqm]"
pip install matplotlib
Running a Simple Qrisp Program
from qrisp import QuantumVariable, h, cx
from matplotlib import pyplot as plt
# This example creates a GHZ state, replace it with your own code
qv = QuantumVariable(3)
h(qv[0])
cx(qv[0], qv[1])
cx(qv[0], qv[2])
# Execute it on the quantum computing backend
# Transpilation is taken care of automatically
result = qv.get_measurement(backend=quantum_computer)
# Print and plot the result
print(result)
plt.bar(result.keys(), result.values())
plt.xlabel("Measurement outcomes")
plt.ylabel("Probability")
plt.show()Conclusion
This tutorial demonstrated how to:
- Connect Qrisp to VTT QX quantum computers.
- Create and execute a simple GHZ quantum circuit.
For more information, check the Qrisp documentation.