0
$\begingroup$

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 ?

$\endgroup$

2 Answers 2

3
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Any alternative ways to do it ? $\endgroup$ Commented Aug 24, 2022 at 13:19
3
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Thanks for the reply, what methods to use to perform it on Qiskit ? $\endgroup$ Commented Aug 22, 2022 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.