Add implementation for SelectTHC bloq - #1942
Conversation
This adds the underlying QROAM and RealGivensRotationByPhaseGradient bloqs to implement the SelectTHC bloq. Tests comparing to the paper toffoli counts were added as well.
Also updates jupyter notebook calls to THC.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
The THCRotation bloq previously used an array of zeros if no theta matrix was provided. This led to incorrect costs due to QROAM optimization. QROAM is now run without data as well in this case.
|
This adds the implementation for the THC select bloq laid out by @fdmalone. This caused some slight changes in the Toffoli counts for this bloq. The differences as best I can tell are the following:
|
There was a problem hiding this comment.
Code Review
This pull request implements the THCRotations bloq, which rotates into the THC basis using a Givens rotation network. It adds the helper _leaf_tensor_to_givens_rotations to compute rotation angles from a THC leaf tensor, updates SelectTHC to integrate these rotations, and adds comprehensive tests and documentation. The reviewer feedback highlights critical issues regarding the handling of one-body terms when two_body_only is False. Specifically, num_terms in THCRotations should account for num_spatial one-body terms, and the bloq needs to accept nu_eq_mp1 to correctly offset the selection index. Additionally, SelectTHC currently lacks a mechanism to accept or compute one-body rotation angles when initialized with a leaf tensor eta for the full Hamiltonian.
The one body rotations when mu=nu+1 were missing, leading to the one body hamiltonian being ignored. These were added in.
Fixes #386. This adds the underlying QROAM and RealGivensRotationByPhaseGradient
bloqs to implement the SelectTHC bloq. Differences in Toffoli costs vs. the paper were
documented in a test.