def _setup(B): if B == 'QI': authentication = get_authentication(B) QI.set_authentication(authentication, QI_URL) sim_backend = QI.get_backend('QX single-node simulator') elif B == 'LOCAL': sim_backend = Aer.get_backend('qasm_simulator') elif B == 'IBMQ': provider = get_authentication(B) sim_backend = provider.get_backend('ibmq_qasm_simulator') return sim_backend
def QI_backend(qi_backend): ''' Backends: 'QX single-node simulator', 'Spin-2', 'Starmon-5' ''' from quantuminspire.qiskit import QI from quantuminspire.credentials import save_account qi_token = '7ff8243ba6d4643e4ec1774b7079f8086df7e872' save_account(qi_token) QI.set_authentication() return QI.get_backend( qi_backend ) # Possible options: 'QX single-node simulator', 'Spin-2', 'Starmon-5'
def QI_backend(qi_backend): ''' Backends: 'QX single-node simulator', 'Spin-2', 'Starmon-5' ''' from quantuminspire.qiskit import QI from quantuminspire.credentials import save_account qi_token = '5697ec173ded946fc884e20d46b523de320a625c' save_account(qi_token) QI.set_authentication() return QI.get_backend( qi_backend ) # Possible options: 'QX single-node simulator', 'Spin-2', 'Starmon-5'
Copyright 2018-19 QuTech Delft. Licensed under the Apache License, Version 2.0. """ import os from qiskit import execute from qiskit.circuit import QuantumRegister, ClassicalRegister, QuantumCircuit from quantuminspire.credentials import get_authentication from quantuminspire.qiskit import QI QI_URL = os.getenv('API_URL', 'https://api.quantum-inspire.com/') project_name = 'Qiskit-entangle' authentication = get_authentication() QI.set_authentication(authentication, QI_URL, project_name=project_name) qi_backend = QI.get_backend('QX single-node simulator') q = QuantumRegister(2) b = ClassicalRegister(2) circuit = QuantumCircuit(q, b) circuit.h(q[0]) circuit.cx(q[0], q[1]) circuit.measure(q, b) qi_job = execute(circuit, backend=qi_backend, shots=256) qi_result = qi_job.result() histogram = qi_result.get_counts(circuit) print('\nState\tCounts') [ print('{0}\t\t{1}'.format(state, counts))