Skip to content
Discussion options

You must be logged in to vote
from qibo.models.encodings import comp_basis_encoder


nqubits = 3
with open('4mod5.qasm', 'r') as file:
    content = file.read()
    qasm_circuit = Circuit.from_qasm(content)
    for string in ["".join(seq) for seq in itertools.product("01", repeat=nqubits)]:
        init = comp_basis_encoder(string)
        init  += qasm_circuit  # this step works if both circuits have the same number of qubits
        init.add(gates.M(*range(nqubits)))
        result = init(nshots=4096)
        # analyse results

When it comes to measurements, adding them or not is a choice. I do not think there is a more concise way than the one you are already doing. If you want the exact statevector, you could just …

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@geexie
Comment options

@renatomello
Comment options

Answer selected by geexie
Comment options

You must be logged in to vote
1 reply
@geexie
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants