I want to perform post-selection on IBM Qiskit and run on actual quantum computer. (What is post-selection) How can I perform it ?
Can I use qiskit.circuit.QuantumCircuit.reset for it ? How to use it ?
I want to perform post-selection on IBM Qiskit and run on actual quantum computer. (What is post-selection) How can I perform it ?
Can I use qiskit.circuit.QuantumCircuit.reset for it ? How to use it ?
Update
BitArray class now has postselect() that returns all shots containing specified bit values. For example,
from qiskit.primitives.containers import BitArray
ba = BitArray.from_counts({'110': 2, '100': 4, '000': 3})
print(ba.postselect([0,2], [0,1]).get_counts())
# {'110': 2, '100': 4}
Original Answer
Qiskit is used to have get_subsystems_counts function which takes complete_system_counts and returns the counts subject to a post selection specified using post_select_index and post_select_flag parameters.
complete_system_counts = { '10 1': 255, '11 0':320, '01 1': 449 }
result = get_subsystems_counts(complete_system_counts, 1, '1')
print(result)
However, since get_subsystems_counts is part of Qiskit Aqua, it is now deprecated. I'm not aware of any alternative, but you can get its code from here.
Postselection isn't a gate. You can't apply it on an actual quantum computer.
What you can do is take many unpostselected samples and discard the ones that didn't meet the selection criteria.