-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30e4835
commit 5881b91
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from qdao import Engine | ||
from qiskit.circuit.random import random_circuit | ||
from qiskit import transpile | ||
from qiskit_aer import Aer | ||
|
||
num_qubits = 12 | ||
num_primary = 10 | ||
num_local = 8 | ||
|
||
# Create a qiskit quantum circuit `circ` | ||
circ = random_circuit(num_qubits, 10, measure=False, max_operands=2) | ||
backend = Aer.get_backend("aer_simulator") | ||
circ = transpile(circ, backend=backend) | ||
|
||
# `num_primary`: size of a compute unit | ||
# `num_local`: size of a storage unit | ||
eng = Engine(circuit=circ, num_primary=num_primary, num_local=num_local) | ||
eng.run() | ||
|
||
# First transform qiskit circuit to a quafu circuit | ||
from quafu import QuantumCircuit | ||
quafu_circ = QuantumCircuit(1) | ||
quafu_circ.from_openqasm(circ.qasm()) | ||
|
||
# Create a new engine using quafu backend | ||
eng = Engine(circuit=quafu_circ, num_primary=num_primary, num_local=num_local, backend="quafu") | ||
eng.run() | ||
|
||
from qdao.util import retrieve_sv | ||
res = retrieve_sv(num_qubits, num_local=num_local) | ||
print(res) |