qiskit-community / povm-toolbox

A toolbox for the implementation of positive operator-valued measures (POVMs).
https://qiskit-community.github.io/povm-toolbox/
Apache License 2.0
6 stars 0 forks source link

Qubit specifier for POVM implementations #15

Closed timmintam closed 1 month ago

timmintam commented 1 month ago

So far, when we instantiate a POVMImplementation object, we set a number of qubits and assume that the POVM will act on all of the qubits of the circuit that will later be supplied.

Would it be interesting to be able to initialize POVMImplementation objects by specifying a subset of qubits to be measured (for instance as a sequence of QubitSpecifier or a list of integers) ?

mrossinek commented 1 month ago

Yes, that's a very good point!

In fact, now that we require some part of transpilation to already have been completed, we should consider that a circuit may already be transpiled for a device's coupling map (i.e. span e.g. 127 qubits) while the actual circuit may only act on a subset of these. Without the proposed feature, we won't be able to tell the POVM which qubits to measure on (despite the fact that we won't be able to tell it not to randomize measurements over all 127 qubits).

timmintam commented 1 month ago

Yes!

Actually with the transpilation/routing PR #13, this specific case of circuit transpiled for a device's coupling map is already tackled and dealt within the povm_implementation.compose_circuits method:

def compose_circuits(self, circuit: QuantumCircuit) -> QuantumCircuit:

    ...

    if isinstance(circuit.layout, TranspileLayout):
        # Extract the final layout of the transpiled circuit (ancillas are filtered).
        index_layout = circuit.layout.final_index_layout(filter_ancillas=True)

    ...

    # Compose the two circuits with the correct routing.
    return circuit.compose(self.msmt_qc, qubits=index_layout)

Still we should generalize this and enable the option for the end user to specify on which qubits the POVM acts in general.

Question : once we enable this feature, should we keep this "under the hood" routing shown above or should we require the end user to take care of this routing for transpiled circuits?