Archived
1
0
This repository has been archived on 2023-07-24. You can view files and clone it, but cannot push or open issues or pull requests.
qalg/quantum_runner/__init__.py

32 lines
737 B
Python
Raw Normal View History

2023-07-24 16:56:29 +05:30
from qiskit import execute,QuantumCircuit
def quantum_simulate(circuit,backend,counts=False,shots=1024):
exe = execute(circuit,backend=backend,shots=shots)
if counts:
return exe.result().get_counts()
else:
return exe
from dotenv import load_dotenv
#from pathlib import Path
from os import getenv
from qiskit import IBMQ
def setup_IBM():
load_dotenv()
# сохранить аккаунт
IBMQ.save_account(getenv('API_KEY'), overwrite=True)
IBMQ.load_account()
from cirq import QasmOutput,Circuit,Qid
from typing import Tuple
def cirq_qasm(circuit: 'Circuit'):
qasm_output = circuit.to_qasm()
return QuantumCircuit().from_qasm_str(str(qasm_output))
#print(provider.backends())