Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

#793 support Quantum Post-Selection for processing counts #794

Merged
merged 15 commits into from
Jan 31, 2020

Conversation

richardyoung00
Copy link
Contributor

Summary

Add support for Quantum Post-Selection for processing counts as per issue #793

Details and comments

Created a utility method get_subsystems_post_selected which returns a list of dictionaries of counts of measured bit strings for all the other registers for when the indication_register matches the flag_string bit string.

@claassistantio
Copy link

claassistantio commented Jan 28, 2020

CLA assistant check
All committers have signed the CLA.

@claassistantio
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@woodsp-ibm
Copy link
Member

woodsp-ibm commented Jan 29, 2020

Hi, thanks for the contribution. I have a thought....

As the new post select method code is pretty much identical to the prior get_subsystems_counts code, but for an if statement, maybe we could combine the new function into the prior method. It would help with the naming too since the new method name had to be trimmed to fit the max length and lost a little of its description in the process. How about adding two new optional fields to the existing method such that the default behavior is as before, but if set can have post selection something like

def get_subsystems_counts(complete_system_counts, post_select_index=None, select_flag=None):

then the if statement would be included and look something like this

            if post_select_index is None or subsystem_measurements[post_select_index] == select_flag:
                d_l[k] += count

So with the post_select_index default of None it works as before but with a value will the do post selection. Of course this would be explained in docstring that this got the counts with optional post selection. Users of existing get_subsytem_counts would be unaffected since the default behavior is unchanged.

You might have more meaningful names than what I chose above for the parameters, but this was the idea. Any thoughts?

@richardyoung00
Copy link
Contributor Author

Sounds like a good suggestion. I will make the code changes.

Copy link
Member

@woodsp-ibm woodsp-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the submission and the suggested refactor.

@woodsp-ibm woodsp-ibm merged commit 3b14fd2 into qiskit-community:master Jan 31, 2020
mtreinish pushed a commit to mtreinish/qiskit-core that referenced this pull request Nov 20, 2020
…00/master

qiskit-community/qiskit-aqua#793 support Quantum Post-Selection for processing counts
manoelmarques pushed a commit to manoelmarques/qiskit-terra that referenced this pull request Nov 23, 2020
…00/master

qiskit-community/qiskit-aqua#793 support Quantum Post-Selection for processing counts
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants