fplll / fpylll

A Python interface for https://github.com/fplll/fplll
GNU General Public License v2.0
118 stars 60 forks source link

Floating point exception for linearly dependent matrix #272

Open grhkm21 opened 5 months ago

grhkm21 commented 5 months ago

The first example fails, but works again with mpfr float_type. Is this "intended"/normal?


In [1]: from fpylll import GSO, IntegerMatrix

In [2]: M = IntegerMatrix.from_matrix([[1, 0], [0, 1], [1, 1]])

In [3]: G = GSO.Mat(M); _ = G.update_gso()

In [4]: G.babai([0, 0])
---------------------------------------------------------------------------
FloatingPointError                        Traceback (most recent call last)
Cell In[4], line 1
----> 1 G.babai([0, 0])

File /private/tmp/fpylll/src/fpylll/fplll/gso.pyx:2378, in fpylll.fplll.gso.MatGSO.babai()
   2376 vector_fp_nr_barf(cv, v, FT_DOUBLE)
   2377 sig_on()
-> 2378 (<MatGSO_c[Z_NR[mpz_t],FP_NR[d_t]]*>self._core.mpz_d).babai(cw.mpz, cv.d, start, dimension, gso)
   2379 sig_off()
   2380 return vector_z_nr_slurp(cw, ZT_MPZ)

FloatingPointError: Floating point exception

In [5]: G = GSO.Mat(M, float_type="mpfr"); _ = G.update_gso()

In [6]: G.babai([0, 0])
Out[6]: (0, 0, 0)```