Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators.
This module is cirq-scaleway, which provides everything you'll need to run Cirq quantum algorithms on Scaleway Quantum as a Service (QaaS).
To get started with Scaleway Quantum as a Service (QaaS), checkout the following guide and tutorial:
- You must be have an account and be logged into the Scaleway console
- You have create an API key with enough permission to use QaaS
To install the stable version of only cirq-scaleway:
>>> pip install cirq-scaleway
Note, that this will install both cirq-scaleway and cirq-core.
To get all the optional modules installed, you'll have to use pip install cirq or pip install cirq~=1.0.dev for the pre-release version.
In the most simple way, here the code to use cirq-scaleway:
>>> import cirq
>>> from cirq_scaleway import ScalewayQuantumService
>>> service = ScalewayQuantumService(
project_id="<your-scaleway-project-id>", secret_key="<your-scaleway-secret-key>"
)
>>> # Get and display all provided (real or simulated) devices compatible with Cirq
>>> devices = service.devices(min_num_qubits=34)
>>> print(devices)
>>> # Get a specific device by its name
>>> qsim_simulator = service.device(name="qsim_simulation_c64m512")
>>> # Create a device session and run a circuit against it
>>> with qsim_simulator.create_session() as session:
>>> qubit = cirq.GridQubit(0, 0)
>>> circuit = cirq.Circuit(cirq.X(qubit) ** 0.5, cirq.measure(qubit, key='m'))
>>> # Run the circuit on the device
>>> result = session.run(circuit)
>>> print(result)
We love feedback. Feel free to reach us on Scaleway Slack community, we are waiting for you on #opensource.