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

sparse state prep: allow user to pick target bitsize if needed #1430

Merged

Conversation

anurudhp
Copy link
Contributor

  • user can pass a target bitsize instead of always using log(N)
  • normalize the coeff vector passed to StatePreparationViaRotations

@anurudhp
Copy link
Contributor Author

@tanujkhattar ptal

@@ -116,6 +116,7 @@ def assert_bloq_example_serializes_for_pytest(bloq_ex: BloqExample):
'state_prep_via_rotation_symb', # cannot serialize HasLength
'state_prep_via_rotation_symb_phasegrad', # cannot serialize Shaped
'sparse_state_prep_via_rotations', # cannot serialize Permutation
'sparse_state_prep_via_rotations_with_large_target_bitsize', # setting an array element with a sequence.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's going on here? Is it because we can't serialize permutation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I think so

Comment on lines +28 to +33
@pytest.mark.parametrize(
"bloq_ex",
[_sparse_state_prep_via_rotations, _sparse_state_prep_via_rotations_with_large_target_bitsize],
)
def test_examples(bloq_autotester, bloq_ex):
bloq_autotester(bloq_ex)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a slow test that asserts the simulation is correct? The bloq example auto tests do not cover correctness of decomposition, AFAIR ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added simulation tests (at the end)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks

Copy link
Collaborator

@tanujkhattar tanujkhattar left a comment

Choose a reason for hiding this comment

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

LGTM % nits

@tanujkhattar tanujkhattar enabled auto-merge (squash) October 1, 2024 20:51
@tanujkhattar tanujkhattar merged commit d258389 into quantumlib:main Oct 1, 2024
8 checks passed
@anurudhp anurudhp deleted the 2024/09/30-sparse-sp-target-bitsize branch October 1, 2024 21:04
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.

2 participants