quantumlib / Qualtran

Qᴜᴀʟᴛʀᴀɴ is a Python library for expressing and analyzing Fault Tolerant Quantum algorithms.
https://qualtran.readthedocs.io/en/latest/
Apache License 2.0
179 stars 48 forks source link

Registers not getting uncomputed for recently added `PairPotential` Bloq under chemistry/trotter/? #482

Open tanujkhattar opened 1 year ago

tanujkhattar commented 1 year ago

The diff_ij register stores sum of system_i and system_j. We compute the register, use it to compute the SumOfSquares in register sos and then directly free it without uncomputing the result? A similar thing seems to be happening for a bunch of other registers like sos etc. https://github.com/quantumlib/Qualtran/blob/00682cb3f1ba464e31c5bf1e199462ca611a9808/qualtran/bloqs/chemistry/trotter/potential.py#L89-L143

Maybe this is also an issue with some of the other recently added chemistry Bloqs? cc @fdmalone

fdmalone commented 1 year ago

I did not account for uncomputing the arithmetic (it's also ignored in the paper). What's the best way to go about this?

fdmalone commented 1 year ago

I shouldn't say the costs are totally ignored in the paper, but rather it seemed sort of ambiguous to me what is actually done:

Screenshot 2023-11-02 at 8 59 31 AM

Reading this there are two options:

  1. Compute all the pairwise potentials, sum them all up, phase by the sum and the uncompute. Next sentence says this is not possible. I think this is what is proposed in the Jones paper (but not costed out).
  2. Phase by each individual Coulomb potential and uncompute with clifford gates by retaining 2000 qubits (I'm not sure where this 2000 is coming from, but it must be n_p dependent in practice.)

I think I was initially confused by the final two sentences (the constant is the Trotter constant factors), but this is addressed in the follow up paragraph.

So the strategy would to just uncompute the arithmetic for each pair potential, which should be straightforward (although many of these bloqs do not have decompositions so the bloq_counts would just yield 0 right?)

The bloqs were meant to just capture the costs (as a first pass) but we (I) should definitely make it more complete.

fdmalone commented 1 year ago

https://arxiv.org/pdf/2308.12352.pdf page 14

fdmalone commented 1 year ago

xref #485