from mpqp import QCircuit
from mpqp.gates import H, CNOT

circuit = QCircuit([H(0), CNOT(0,1)], label="Bell state")
print(circuit)

from mpqp.execution import run, ATOSDevice

result = run(circuit, ATOSDevice.MYQLM_PYLINALG)
print(result)
print(result.amplitudes)
print(result.probabilities)

from mpqp.measures import BasisMeasure

circuit.add(BasisMeasure([0,1], shots=0))
result = run(circuit, ATOSDevice.MYQLM_PYLINALG)
print(result)

circuit = circuit.without_measurements()
circuit.add(BasisMeasure([0,1], shots=1024))

result = run(circuit, ATOSDevice.MYQLM_PYLINALG)
print(result)
print(result.samples)
print(result.counts)
print(result.probabilities)

from mpqp.execution import IBMDevice, AWSDevice, GOOGLEDevice

results = run(circuit, [ATOSDevice.MYQLM_PYLINALG, IBMDevice.AER_SIMULATOR, AWSDevice.BRAKET_LOCAL_SIMULATOR, GOOGLEDevice.CIRQ_LOCAL_SIMULATOR])
print(results)
print('---------')
print(results[0])

result = run(circuit, IBMDevice.IBMQ_QASM_SIMULATOR)
print(result)

from mpqp.execution import submit

job_id, job = submit(circuit, IBMDevice.IBMQ_QASM_SIMULATOR)
print(job_id)

from mpqp.execution import get_remote_result

result = get_remote_result(job_id, IBMDevice.IBMQ_QASM_SIMULATOR)
print(result)