Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle PrimitiveResult as result type #340

Merged
merged 2 commits into from
May 29, 2024
Merged

Handle PrimitiveResult as result type #340

merged 2 commits into from
May 29, 2024

Conversation

cqc-alec
Copy link
Collaborator

Description

We were assuming a SamplerResult. We still handle that case, though I don't know if it ever occurs.

This PR supersedes #335 .

Related issues

Fixes #334 .

Checklist

  • I have performed a self-review of my code.
  • I have commented hard-to-understand parts of my code.
  • I have made corresponding changes to the public API documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the changelog with any user-facing changes.

@@ -525,11 +533,14 @@ def process_circuits(

qcs, ppcirc_strs = [], []
for tkc in batch_chunk:
tkc1 = tkc.copy()
# Flatten bits to default register in lexicographic order:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This solves the issue raised in this comment. There is still an issue with circuits having non-default classical register names, but this is an independent pre-existing issue and is not addressed in this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to make sure I understand: this does actually all work if pytket-qiskit is used to submit and retrieve the circuit no matter what the classical registers are named. Of course if one separately submits a circuit with non-default classical register names and tries to retrieve it with pytket-qiskit then there is an error... but that is indeed a different issue!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it works unless you then want to call get_counts() on the result with specific bits, using the cbits parameter to get_counts. In that case it will throw an error -- but that was already the case (separate issue).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks that makes sense!

@cqc-alec cqc-alec requested review from mwpb and sjdilkes May 29, 2024 13:10
@cqc-alec cqc-alec marked this pull request as ready for review May 29, 2024 13:11
@cqc-alec cqc-alec requested a review from cqc-melf as a code owner May 29, 2024 13:11
Copy link
Collaborator

@mwpb mwpb left a comment

Choose a reason for hiding this comment

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

Have tested this by hitting IBM using this local branch and everything seems to work well for me! Did have one question but is for my understanding and doesn't affect the PR. Feel free to merge or wait for others more familiar with the code to take a look also.

@@ -525,11 +533,14 @@ def process_circuits(

qcs, ppcirc_strs = [], []
for tkc in batch_chunk:
tkc1 = tkc.copy()
# Flatten bits to default register in lexicographic order:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to make sure I understand: this does actually all work if pytket-qiskit is used to submit and retrieve the circuit no matter what the classical registers are named. Of course if one separately submits a circuit with non-default classical register names and tries to retrieve it with pytket-qiskit then there is an error... but that is indeed a different issue!

@cqc-alec cqc-alec merged commit 3c749dd into develop May 29, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Job results from IBMQ devices are not (always) SamplerResult
2 participants