A cross-platform, open-source, high-level quantum computing library
Project description
Introduction
quantumcat is a platform-independent, open-source, high-level quantum computing library, which allows the quantum community to focus on developing platform-independent quantum applications without much effort.
It is based on two principles:
-
Write once and execute on any supported quantum provider using one syntax
-
quantumcat should enable researchers and developers to create quantum applications using high-level programming in the future so that they can focus on developing quantum applications instead of learning low-level concepts such as gates and circuits
Write once
from quantumcat.utils import providers
num_of_qubits = 2
qc = QCircuit(num_of_qubits)
qc.h_gate(0)
qc.cx_gate(0, 1)
# To execute on Google Cirq
result = qc.execute(provider=providers.GOOGLE_PROVIDER, repetitions=1024)
# To execute on IBM Qiskit
result = qc.execute(provider=providers.IBM_PROVIDER, repetitions=1024)
# To execute on Amazon Braket
result = qc.execute(provider=providers.AMAZON_PROVIDER, repetitions=1024)
Compare the results of all the supported providers with a single line of code
# Execute on All providers in one go
circuit.compare_results(plot=True)
Execute on real IBM quantum hardware with quantumcat
from quantumcat.utils import providers
result = qc.execute(provider=providers.IBM_PROVIDER,
api='API KEY from IBM Quantum dashboard',
device='IBM DEVICE NAME such as ibmq_manila or ibmq_quito')
# Copy API and Device name from https://quantum-computing.ibm.com/
Installation
pip install quantumcat
Platforms Supported
- Google Cirq
- IBM Qiskit
- Amazon Braket
- IonQ (Via Braket)
- Rigetti (Via Braket)
Gates Supported
Click here to view gates supported
Examples
Circuit Creation
from quantumcat.circuit import QCircuit
num_of_qubits = 3
qc = QCircuit(num_of_qubits)
Single-Qubit Gate
qc.x_gate(0) # applies X gate on qubit 0
Two-Qubit Gate
qc.cx_gate(0, 1) # control qubit, target qubit
Multi-Qubit Gate
qc.mct_gate([0, 1], 2) # control qubits array, target qubit
Draw Circuit
from quantumcat.utils import providers
qc.draw_circuit(provider=providers.GOOGLE_PROVIDER)
High-Level Functions
Superposition
qc.superposition(0)
# puts qubit 0 in superposition
Entanglement
qc.entangle(0, 1)
# entangles qubit 0 with qubit 1
Phase Kickback
qc.phase_kickback(0)
# applies |-> to qubit 0
High-Level Applications
Random Number Generator
from quantumcat.utils import providers, constants
from quantumcat.applications.generator import RandomNumber
random_number = RandomNumber(length=2, output_type=constants.DECIMAL).execute(provider=providers.GOOGLE_PROVIDER)
print(random_number)
# To generate random number on actual IBM device
random_number = RandomNumber(length=2, output_type=constants.DECIMAL)
.execute(provider=providers.IBM_PROVIDER, repetitions=1024, api='API KEY from IBM Quantum dashboard'
device='IBM DEVICE NAME such as ibmq_manila or ibmq_quito')
print(random_number)
Password Generator
from quantumcat.applications.generator import Password
password = Password(8).generate()
print(password)
# Length should be between 5 - 20
# Password is generated in hexadecimal format using QRNG@ANU JSON API
OTP Generator
from quantumcat.applications.generator import OTP
otp = OTP().generate()
print(otp)
# 5 digits OTP is generated using QRNG@ANU JSON API
Visualization
Histogram
circuit = QCircuit(1)
circuit.superposition(0)
counts = circuit.execute(provider=providers.GOOGLE_PROVIDER, repetitions=1024)
circuit.histogram(counts)
Bloch Multivector
circuit = QCircuit(1)
circuit.superposition(0)
state = circuit.execute(provider=providers.GOOGLE_PROVIDER,
simulator_name=constants.STATEVECTOR_SIMULATOR)
circuit.bloch_multivector(state)
QSphere
circuit = QCircuit(1)
circuit.superposition(0)
state = circuit.execute(provider=providers.GOOGLE_PROVIDER,
simulator_name=constants.STATEVECTOR_SIMULATOR)
circuit.state_qsphere(state)
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quantumcat-0.1.8.tar.gz.
File metadata
- Download URL: quantumcat-0.1.8.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47b8b916b1735ebf4d298e50d957f8d2a53cdcb293358ed7c82a62310f3f88a9
|
|
| MD5 |
35348407a1c8c48fa72339d0fc47dcb5
|
|
| BLAKE2b-256 |
e228c1d0795c8e3da4d5c8596edff08ac5b5b898e6dcee2fc9758b954c772ba9
|
File details
Details for the file quantumcat-0.1.8-py3-none-any.whl.
File metadata
- Download URL: quantumcat-0.1.8-py3-none-any.whl
- Upload date:
- Size: 73.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
981b848c95140ad3c19e33679a802ee90c1fbf8f3279d60b32e47ce5e56453e5
|
|
| MD5 |
e361955029677bd73dda00d06eacba40
|
|
| BLAKE2b-256 |
4cd26025cd050a3bcf1f19d431495eb40447331c2baeae0a9da296c46957cc85
|