Sycamore random circuit example¶
Overview¶
This example demonstrates how to:
Import a Sycamore-style random circuit from OpenQASM 2.0
Add measurement
Execute the circuit
Retrieve sampled results
For information about downloadable circuit datasets, see Downloadable Circuits.
For the general execution workflow (provider → backend → circuit → run), see Circuits.
Import a Sycamore circuit¶
Sycamore random circuits are typically distributed as OpenQASM 2.0 files.
Import the circuit using QuantumCircuit.from_qasm_file(...):
from QuantumRingsLib import QuantumCircuit
qc = QuantumCircuit.from_qasm_file("sycamore_rqc.qasm")
Add measurement¶
If the imported circuit does not include measurement instructions, add measurement before execution.
qc.measure_all()
See Measurement for details on measurement behavior.
Execute the circuit¶
Acquire a backend and execute the circuit:
from QuantumRingsLib import QuantumRingsProvider
provider = QuantumRingsProvider()
backend = provider.get_backend("scarlet_quantum_rings")
job = backend.run(qc, shots=100)
result = job.result()
Retrieve results¶
Access measurement output using:
memory = result.get_memory()
counts = result.get_counts()
print(memory[:10])
print(counts)
Scaling considerations¶
Sycamore random circuits are often large and may use many qubits. Ensure the circuit size is compatible with your account limits.
For configuration options such as precision and execution mode, see Run Settings.
See also¶
Return to Quantum Rings SDK Documentation.