Add end to end qubitization example for 2D Hubbard model from Linear T complexity paper#224
Add end to end qubitization example for 2D Hubbard model from Linear T complexity paper#224tanujkhattar merged 16 commits intomainfrom
Conversation
…into hubbard_qubitization
…cirq-qubitization into hubbard_qubitization
There was a problem hiding this comment.
Looks great up to a bit more exposition in the notebook. In particular I think it's a great place to compare to the linear T paper in a bit more depth. They provide formula and make approximations for the T complexity so it should be possible to include a few more figures and comment on where the missing T gates are.
| "This follows section V. of the [Linear T Paper](https://arxiv.org/abs/1805.03662).\n", | ||
| "\n", | ||
| "The Hubbard model is a special case of the electronic structure Hamiltonian\n", | ||
| "restricted to spins on a planar grid.\n", |
There was a problem hiding this comment.
I'd be careful saying spins here, it's still a fermionic model and spins have some separate meaning in the model condensed matter world. Also it's not really rrestricted to live in a plane. The 1D and 3D Hubbard models are well defined models.
| "- `x_dim`: the number of sites along the x axis.\n", | ||
| "- `y_dim`: the number of sites along the y axis.\n", | ||
| "- `t`: coefficient for XZX and YZY terms in the Hubbard model hamiltonian.\n", | ||
| "- `mu`: coefficeint for single body Z term and two-body ZZ terms in the Hubbard model hamiltonian.\n", |
There was a problem hiding this comment.
What is mu? I think you're calling mu = 4 t below, but it seems a bit unusual to me, normally one measures things in units of t, U = 4 t is just intermediate coupling.
There was a problem hiding this comment.
The u in 57 is the same as the u in 56 right? When I saw mu I thought
There was a problem hiding this comment.
Should I rename mu to u ? There is already a capital U so I'm not sure if it'll cause more confusion.
There was a problem hiding this comment.
I think it should just be u? They use capital U to mean something else in the paper.
…into hubbard_qubitization
…into hubbard_qubitization
tanujkhattar
left a comment
There was a problem hiding this comment.
@fdmalone I've addressed all of your comments and also updated the notebook to show comparison of T-complexity costs obtained by our SELECT / PREPARE gates with the formulas given the paper. Specifically, the T-complexity for SELECT matches exactly (10*N + logN) and for PREPARE the paper only specifies an asymptotic cost of O(logN) whereas we demonstrate exact constant factors of 32 * logN in the paper.
I've also made the SVG diagrams nicer to include the T-complexity cost for each operation within the diagram. This is helpful to visualize the contribution of each operation in the decomposition.
This is ready for a re-review, PTAL!
|
@fdmalone I also fixed the formula for calculating Now, for a 20 x 20 2D Hubbard model grid, the end to end resource costs for heisenberg limited phase estimation using constants same as Table-IV of the paper gives the following resource costs: Comparing to Table-IV, this is now much closer than the approximated number of
|
| "plt.xlabel('N')\n", | ||
| "plt.ylabel('T-costs')\n", | ||
| "plt.title('$SELECT_{Hubbard}$')\n", | ||
| "plt.plot(x, y, label='$10 * N + 14 * logN - 8$')\n", |
There was a problem hiding this comment.
I might just add marker="o" here or your favourite symbol. It's nice to see the specific points. But feel free to ignore.
I updated the plotting code to also print the resource counts (number of T-gates and rotation gates) for each gate in the circuit. This is indicated by setting an additional flag when plotting the decomposition of an operation - |
| "metadata": { | ||
| "cq.autogen": "_make_SelectHubbard.md" | ||
| }, |
There was a problem hiding this comment.
so these cells were originally auto-generated using the jupyter autogen functionality in my PR. can you add their entries back in?
There was a problem hiding this comment.
Do we have support for auto generating multiple cells (like for SELECT and PREPARE) using the autogen feature? I thought we were restricted to the simpler cases of generating 1 cell per notebook (eg: what was done in _make_SelectHubbard ) and thus I decided to remove tha autogen functionality.
| "plt.xlabel('N')\n", | ||
| "plt.ylabel('T-costs')\n", | ||
| "plt.title('$PREPARE_{Hubbard}$')\n", | ||
| "plt.plot(x, y_t, label='$O(logN)$ T-cost', marker=\"o\")\n", |
There was a problem hiding this comment.
I find these labels confusing. the first is the actual T cost, right? so why is it labeled with big-O?
There was a problem hiding this comment.
Yes, because we don't have a simple formula for the exact T-cost since PrepareUniformSuperposition's cost depends on the factorization of the integer. Thus, it's upper bounded by O(logN) as given in the paper. I also plot an upper bounding constant.
cirq_qubitization/cirq_algos/phase_estimation_of_quantum_walk.py.ipynb
Outdated
Show resolved
Hide resolved
|
|
||
| Args: | ||
| x_dim: the number of sites along the x axis. | ||
| y_dim: the number of sites along the y axis. |
There was a problem hiding this comment.
document control_val; should this be cv like elsewhere?
There was a problem hiding this comment.
Yeah, but I want to punt the renaming of control_val to cvs for a later PR since it would also change the interface from Optional[int] to Tuple[int, ...].





Implements SELECT and PREPARE for Hubbard model as described in Section V of https://arxiv.org/abs/1805.03662
Uses the newly added SELECT / PREPARE oracles to construct a Qubitization walk operator and perform Heisenberg limited phase estimation on the walk operator. Outputs resource counts for a 10x10 hubbard model grid in under ~1 second.
Fixes #31