Skip to main content

Qiskit Backend for QuantumRings

Project description

Step 1. Import the required libraries

from qiskit.circuit import QuantumCircuit
from qiskit import QuantumCircuit, transpile, QuantumRegister, ClassicalRegister, AncillaRegister
from qiskit.visualization import plot_histogram
from matplotlib import pyplot as plt

import QuantumRingsLib
from QuantumRingsLib import QuantumRingsProvider
from quantumrings.toolkit.qiskit import QrBackendV2
from quantumrings.toolkit.qiskit import QrJobV1

from matplotlib import pyplot as plt

Step 2. Obtain the Quantum Rings Provider

Do not forget to replace your account key and account name.

qr_provider = QuantumRingsProvider(token = <ACCOUNT_KEY>, name=<ACCOUNT_NAME>)

Step 3. Build the Quantum Circuit using Qiskit provided functions

shots = 1000
numberofqubits = int(qr_provider.active_account()["max_qubits"])
q = QuantumRegister(numberofqubits , 'q')
c = ClassicalRegister(numberofqubits , 'c')
qc = QuantumCircuit(q, c)


# Create the GHZ state (Greenberger–Horne–Zeilinger)
qc.h(0);
for i in range (qc.num_qubits - 1):
    qc.cx(i, i + 1);

# Measure all qubits
qc.measure_all();

Step 4. Transpile the code for Quantum Rings SDK

mybackend = QrBackendV2(qr_provider)
qc_transpiled = transpile(qc, mybackend)

Step 5. Execute the code and plot the histogram

job = mybackend.run(qc_transpiled, shots = shots)
result = job.result()
counts = result.get_counts()
plot_histogram(counts)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file quantumrings_toolkit_qiskit-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for quantumrings_toolkit_qiskit-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9dd9c74cc177f60df1cdb9c33b9155b4c732c74fd44e06aa7340836c3c8c14f0
MD5 16f38f743f3695ac15e61e2b1528e362
BLAKE2b-256 90f427cfc70adeb3c3fab6d676ce1e6a9cabe51ca14d9616aaedda872d0e89bc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page