lattice-estimator
lattice-estimator copied to clipboard
Crashes in SISLattice
I was playing around with the estimator for SIS and noticed crashes for certain parameters (see below for examples) in the cost_zeta method of SISLattice when searching for beta.
https://github.com/malb/lattice-estimator/blob/dfbc6222eb32db0d595bc45473c22c5d315de4f4/estimator/sis_lattice.py#L231-L239
- If
baseline_cost["beta"] + 1is smaller than 40, we get a ValueError because we try to search in an empty range. - If
baseline_cost["beta"] + 1is equal to 41, we get a TypeError: Becauseprecisionis set to2, thestartandstopparameters oflocal_minimumare divided by two, resulting in an empty range[20,20)due to rounding and no neighborhood can be computed.
Maybe the SIS parameters in the examples below are obviously stupid for a lattice expert, but it would be nicer to have a helpful error message that explains what went wrong and maybe indicates how to change the parameters to obtain useful results.
Examples Code and Stack Traces
from estimator import *
# results in `ValueError: Incorrect bounds 20 > 10`
params = SIS.Parameters(n=1, q=2^1000, length_bound=2^100, norm=oo)
est = SIS.lattice(params)
Traceback (most recent call last):
File "/home/lennart/dev/lattice-estimator/test.sage.py", line 11, in <module>
est = SIS.lattice(params)
^^^^^^^^^^^^^^^^^^^
File "/home/lennart/dev/lattice-estimator/estimator/sis_lattice.py", line 329, in __call__
f(
File "/home/lennart/dev/lattice-estimator/estimator/sis_lattice.py", line 232, in cost_zeta
with local_minimum(
^^^^^^^^^^^^^^
File "/home/lennart/dev/lattice-estimator/estimator/util.py", line 256, in __init__
local_minimum_base.__init__(self, start, stop, smallerf, suppress_bounds_warning, log_level)
File "/home/lennart/dev/lattice-estimator/estimator/util.py", line 97, in __init__
raise ValueError(f"Incorrect bounds {start} > {stop}.")
ValueError: Incorrect bounds 20 > 10.
from estimator import *
# results in `TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'`
params = SIS.Parameters(n=1, q=2^10000, length_bound=2^100, norm=oo)
est = SIS.lattice(params)
Traceback (most recent call last):
File "/home/lennart/dev/lattice-estimator/test.sage.py", line 15, in <module>
est = SIS.lattice(params)
^^^^^^^^^^^^^^^^^^^
File "/home/lennart/dev/lattice-estimator/estimator/sis_lattice.py", line 329, in __call__
f(
File "/home/lennart/dev/lattice-estimator/estimator/sis_lattice.py", line 237, in cost_zeta
for beta in it.neighborhood:
^^^^^^^^^^^^^^^
File "/home/lennart/dev/lattice-estimator/estimator/util.py", line 273, in neighborhood
start = max(start_bound, self.x - self._precision)
^^^^^^
File "/home/lennart/dev/lattice-estimator/estimator/util.py", line 264, in x
return self._best.low * self._precision
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'