Qualtran
Qualtran copied to clipboard
Support for higher precision in QROMs
This line in QROMBase limits the precision for the data used in SelectSwapQROM. https://github.com/quantumlib/Qualtran/blob/0d8793e8a7f415d6ec1e003756422d72ac81a3a1/qualtran/bloqs/data_loading/qrom_base.py#L238
For some applications, the target bitsize for the data I need to load is quite high. I am able to represent them as integers since Python integers have unlimited precision, but the use of a numpy array above results in the error RuntimeWarning: invalid value encountered in cast
and prevents resource analysis.
To reproduce the error:
powers = [61,62,63,64]
for p in powers:
data = [2**p,2**p-2**32,2**p-2**50]
qroam_gate = SelectSwapQROM([data],target_bitsizes=(max(data).bit_length(),),selection_bitsizes=(len(data),))
print(t_complexity(qroam_gate))