Skip to main content

This package converts the circuit of qiskit into a circuit supported by quafu

Project description

Introduction

This package converts the circuit of qiskit into a circuit supported by quafu The converted circuit can be input to the cloud platform for processing

Input and Output

Input:

qc: QuantumCircuit object of Qiskit

regName (optional): Modified register name

basis_gates (optional): The set of gates supported by the quafu chip

optimization_level (optional): optimization level

Output:

The function returns two objects, quafu_qc and qc_merge

quafu_qc: The circuit instance of quafu

qc_merge: The converted qasm circuit in string form.

Example:

Import packages

from qiskit import QuantumCircuit
from qiskit.quantum_info import Operator
from qiskit2quafu import qiskit2quafu
from quafu import User, Task

Create a circuit

qiskitCircuit = QuantumCircuit(4)
qiskitCircuit.h([0,1,2,3])
qiskitCircuit.mcx([0,1,2],3)
qiskitCircuit.ry(0.6,0)
permute = Operator([[0, 0, 1, 0, 0, 0, 0, 0],
                    [1, 0, 0, 0, 0, 0, 0, 0],
                    [0, 1, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 1, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 1],
                    [0, 0, 0, 0, 0, 1, 0, 0],
                    [0, 0, 0, 0, 0, 0, 1, 0],
                    [0, 0, 0, 0, 1, 0, 0, 0]])
qiskitCircuit.unitary(permute, [0,1,3], label='P')
qiskitCircuit.draw(output='mpl')

Call the transfer function

quafu_gates = ['cx','cy','cz','cp','u1','u2','u3','h','id','swap','cswap','p','rx','ry',
               'rz','x','y','z','s','sdg','t','tdg','sx','ccx','rxx','ryy','rzz']

quafuCircuit, transpiled_qasm = qiskit2quafu(qiskitCircuit)
quafuCircuit.draw_circuit()

After transfer, the new circuit can be supported by quafu.

To upload the task, refer to https://scq-cloud.github.io/

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

qiskit2quafu-0.0.13.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qiskit2quafu-0.0.13-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file qiskit2quafu-0.0.13.tar.gz.

File metadata

  • Download URL: qiskit2quafu-0.0.13.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for qiskit2quafu-0.0.13.tar.gz
Algorithm Hash digest
SHA256 d81b31637cd4951b2ef3f0697a4b1ef08f7f5b39aa7a790bffb4d29fe4a68f46
MD5 f1fd64564ad001ea4d5885f6b0d2bae1
BLAKE2b-256 840e54736df0ff6cc6b7881b1a998f20af7e0c476ef7a9b6dccae15408587fde

See more details on using hashes here.

File details

Details for the file qiskit2quafu-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: qiskit2quafu-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for qiskit2quafu-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 470facd4c897efe646accb545c05845fb9a716eaedc276e66e8abe9148907ba9
MD5 3cb83b14b654ac57e491bc3f275fc2b3
BLAKE2b-256 ac0cb0f1203966fa4bf5bbc7a5f1fc2d622b5493667a2a2eb26e8a7e2c49af03

See more details on using hashes here.

Supported by

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