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
177 stars 44 forks source link

Refactor state preparation routines #1190

Open tanujkhattar opened 3 months ago

tanujkhattar commented 3 months ago

Both the state preparation routines are bottlenecked by QROM, so it'll be nice to have a way to configure which QROM bloq should be used to do the data loading (QROM vs SelectSwapQROM using clean or dirty qubits)

fdmalone commented 3 months ago

Re StatePreparationAliasSampling isn't the usual trick to take the absolute value, load signs in qrom and then apply phases using a CZ?

tanujkhattar commented 3 months ago

The amplitudes can also be complex in general -- suppose you want to prepare a state

$$\sum_{x} ||f(x)|| e^{i\phi(x)} \ket{x}\ket{\text{garbage}}_x$$

but state prep alias sampling gives you

$$\sum_{x} ||f(x)|| \ket{x}\ket{\text{garbage}}_x$$

You can then do qrom with addition into phase gradient to synthesize the complex phases $e^{i\phi(x)}$ (or club it with the QROM of alias sampling followed by addition into phase gradient, which is equivalent to what you are saying but for the case when phases are just +1 / -1)