Open tanujkhattar opened 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?
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)
StatePreparationAliasSampling
usesQROM
instead ofSelectSwapQROM
. We should make this a configurable choice.StatePreparationViaRotations
prepares amplitudes usingself._prepare_amplitudes(bb, **soqs)
and phases usingself._prepare_phases
. The logic inself._prepare_phases
can be pulled out in a separate Bloq.StatePreparationAliasSampling
expects positiveunnormalized_probabilities
instead ofamplitudes
. We can update it to expect amplitudes and use strategy used byStatePreparationViaRotations
; i.e. we first prepare the absolute value of amplitudes using alias sampling then delegate to theprepare_phases
bloq above to prepare the right phases.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
vsSelectSwapQROM
using clean or dirty qubits)