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

Do not allow creating registers with bitsize 0 #6298

Merged
merged 2 commits into from
Sep 25, 2023

Conversation

tanujkhattar
Copy link
Collaborator

Registers with bitsize 0 are ambiguous since they you are not really passing any qubits to instantiate those registers. They also complicate the interop with Qualtran. This PR removes this workflow by adding an explicit validation that bitsize should always be a positive integer.

cc @mpharrigan

@tanujkhattar tanujkhattar requested review from cduck and a team as code owners September 21, 2023 22:46
@tanujkhattar tanujkhattar requested a review from maffoo September 21, 2023 22:46
@CirqBot CirqBot added the size: S 10< lines changed <50 label Sep 21, 2023
@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (8e4e7d1) 97.88% compared to head (a63eee2) 97.88%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6298   +/-   ##
=======================================
  Coverage   97.88%   97.88%           
=======================================
  Files        1104     1104           
  Lines       95863    95869    +6     
=======================================
+ Hits        93840    93846    +6     
  Misses       2023     2023           
Files Changed Coverage Δ
cirq-ft/cirq_ft/algos/and_gate.py 100.00% <100.00%> (ø)
cirq-ft/cirq_ft/algos/apply_gate_to_lth_target.py 100.00% <100.00%> (ø)
...-ft/cirq_ft/algos/prepare_uniform_superposition.py 100.00% <100.00%> (ø)
cirq-ft/cirq_ft/algos/qrom.py 100.00% <100.00%> (ø)
cirq-ft/cirq_ft/algos/selected_majorana_fermion.py 100.00% <100.00%> (ø)
cirq-ft/cirq_ft/algos/state_preparation.py 100.00% <100.00%> (ø)
cirq-ft/cirq_ft/infra/gate_with_registers.py 96.32% <100.00%> (+0.11%) ⬆️
cirq-ft/cirq_ft/infra/gate_with_registers_test.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -77,7 +77,7 @@ def selection_registers(self) -> Tuple[infra.SelectionRegister, ...]:

@cached_property
def target_registers(self) -> Tuple[infra.Register, ...]:
total_iteration_size = np.product(
total_iteration_size = np.prod(
Copy link
Collaborator

Choose a reason for hiding this comment

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

for my edification: why this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It fails mypy checks because np.product has been deprecated.

@tanujkhattar tanujkhattar merged commit acbc624 into quantumlib:master Sep 25, 2023
@tanujkhattar tanujkhattar added the area/cirq-ft Issues related to the Cirq-FT sub-package label Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cirq-ft Issues related to the Cirq-FT sub-package size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants