-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Round device specs (max_amplitude and min_distance) such that during the rescale operation in the program compilation, the new register and the new drive does not accidentally go out of bounds due to rounding errors.
Description
Pulser impose device bounds at floating point precision. For example, on pulser.DigitalAnalogDevice, the max amplitude is:
>>> from pulser import DigitalAnalogDevice
>>> DigitalAnalogDevice.channels["rydberg_global"].max_amp
15.707963267948966For Pulser, every amplitude must be strictly smaller than that. Since the compilation stage rescale amplitudes, it might happen that, due to rounding off errors, we end up with some amplitude ~1e-14 higher than that. This triggers an error in compilation.
To solve
Store device bounds as rounded up/down numbers from Pulser devices. From the example before:
pulser_max_amp = 15.707963267948966
qoolqit_max_amp = 15.70796326794896Edge cases to cover
1.
from qoolqit import QuantumProgram, DigitalAnalogDevice, CompilerProfile, Register, Drive, Ramp
register = Register.from_coordinates([(-2,0),(2,0)])
drive = Drive(amplitude=Ramp(10.0, 0.2, 0.453453453))
program = QuantumProgram(register, drive)
profile = CompilerProfile.MAX_AMPLITUDE
program.compile_to(device = DigitalAnalogDevice(), profile=profile)Raises a ValueError: The pulse's amplitude goes over the maximum value allowed for the chosen channel.
3.
Actions
- add
floor_floatandceil_floatfunctions to round up/down Pulser device specs. - add tests to cover the edge cases
- remove test restrictions due to this issue (see for example here)