I was trying to see what would happen to the resource counts if I replaced QROM with SelectSwapQROM in StatePreparationViaRotation and I ran into an issue. A drop in replacement doesn't work. It fails in a way that is captured in this MWE:
import numpy as np
from qualtran.bloqs.data_loading.qrom import QROM
from qualtran.bloqs.data_loading.select_swap_qrom import SelectSwapQROM
data = np.array([1])
selection_bitsize = 0
target_bitsize = 2
control_bitsize = 1
qrom = QROM(
[data],
selection_bitsizes=(selection_bitsize,),
target_bitsizes=(target_bitsize,),
num_controls=control_bitsize,
)
select_swap_qrom = SelectSwapQROM(
[data],
selection_bitsizes=(selection_bitsize,),
target_bitsizes=(target_bitsize,),
num_controls=control_bitsize,
)
This looks like a case where a more sensible error should be raised, does SelectSwapQROM make sense with a length 1 array (I think the answer is it should handle it gracefully).
I was trying to see what would happen to the resource counts if I replaced QROM with SelectSwapQROM in StatePreparationViaRotation and I ran into an issue. A drop in replacement doesn't work. It fails in a way that is captured in this MWE: