Skip to content

Introduce types to t_complexity #835

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

Merged
merged 8 commits into from
Aug 6, 2024

Conversation

mpharrigan
Copy link
Collaborator

Everything is a bloq now, so we can indicate that with types in the t_complexity function. It will now duck-type for bloqs. There are some tests that still want to find the t complexity of things that contain bloqs, so I added a _compat version. I moved all the places where you literally need to get the TComplexity to a gate to explicit calls to _from_directly_countable (now with a _cirq suffix) so its more explicit where these values are coming from.

Depends on #825

@mpharrigan mpharrigan changed the title Introduce types to t_complexity Introduce types to t_complexity Mar 29, 2024
@mpharrigan mpharrigan force-pushed the 2024-03/typed-t-complexity branch from 3839e7c to 0f6d91f Compare May 16, 2024 20:23
@mpharrigan mpharrigan force-pushed the 2024-03/typed-t-complexity branch from 0f6d91f to 67109b3 Compare June 25, 2024 00:08
@mpharrigan
Copy link
Collaborator Author

@tanujkhattar fyi, I still want to do this.

Current status

  • need to add controlled-Y and controlled-H to get the tests to keep passing. I'll factor out the addition of these gates into their own pr.
  • I hacked in a consideration for Controlled(ZGate()) but we really should have a native CZ lol
  • For adding gates: I want to wait for Tensor Simulation protocol 2: keep indices factorized #1070 before adding tensors to the new gates to avoid merge conflicts

Getting things completely bloq-y will enable a seamless transition to the QECGatesCost cost

@mpharrigan mpharrigan force-pushed the 2024-03/typed-t-complexity branch from 160c806 to f34659b Compare July 23, 2024 20:54
@mpharrigan mpharrigan marked this pull request as ready for review July 23, 2024 20:54
@mpharrigan
Copy link
Collaborator Author

This is ready for preliminary review, although I will continue testing things on my side.

@mpharrigan
Copy link
Collaborator Author

Ok, I called t_complexity on each bloq example before and after the change. They all match, except the following bloq examples used to error and now return values

223          SparseMatrix.explicit_matrix_block_encoding
224            SparseMatrix.sparse_matrix_block_encoding
225       SparseMatrix.sparse_matrix_symb_block_encoding
253    TextbookQPE.textbook_qpe_from_precision_and_delta
254    TextbookQPE.textbook_qpe_from_standard_deviati...
256                TextbookQPE.textbook_qpe_using_m_bits

@mpharrigan
Copy link
Collaborator Author

These ones used to cause errors and still do

16            AutoPartition.auto_partition
17     AutoPartition.auto_partition_unused
56                            ECAdd.ec_add
57                         ECAddR.ec_add_r
58                   ECAddR.ec_add_r_small
59                  ECPhaseEstimateR.ec_pe
60            ECPhaseEstimateR.ec_pe_small
61              ECWindowAddR.ec_window_add
63                   FindECCPrivateKey.ecc
103               MinusEffect.minus_effect
104                 MinusState.minus_state
105                         ModAdd.mod_add
123                   OneEffect.one_effect
124                     OneState.one_state
146                 PlusEffect.plus_effect
148                   PlusState.plus_state
170    Product.product_block_encoding_symb
272                 ZeroEffect.zero_effect
273                   ZeroState.zero_state

@mpharrigan mpharrigan requested a review from tanujkhattar July 30, 2024 23:30
@mpharrigan
Copy link
Collaborator Author

@tanujkhattar can you ptal

@mpharrigan mpharrigan merged commit 6a4b920 into quantumlib:main Aug 6, 2024
8 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.

2 participants