Wow, that's great news! I missed the incorporation of flint. 1. Is there up-to-date documentation about flint being used in sympy anywhere? I see your blog post https://oscarbenjamin.github.io/blog/czi/post2.html but it would be nice to have something in the official docs.
2. Is it worth fixing the sympy implementation of LLL? I would be happy using flint (even making it a required dependency), but I could investigate fixing the sympy implementation for others. Robert On Thu, Oct 17, 2024 at 4:47 AM Oscar Benjamin <oscar.j.benja...@gmail.com> wrote: > > There is some problem with the implementation in SymPy. If you have > python-flint installed it works because it uses the FLINT > implementation. > > >>> print(Matrix(v).to_DM().lll().to_Matrix()) > Matrix([[-1, 0, 2, 0], > [27838432316546329948653649573487634649724968645328, > -49211860671581597598021395402360695743160591979141, > 13919216158273164974326824786743817324862484322663, > -54612160756961593886340461194352260530027628350507], > [39369488537265278078417116321888556594528473583313, > -69596080791365824871634123933719086624312421613319, > 19684744268632639039208558160944278297264236791656, > 125969787835055438793681187979620981611206915732087]]) > > The assertion that fails is here: > https://github.com/sympy/sympy/blob/e65784eb972b9e3a7f62520a8069f5dbb77ca96b/sympy/polys/matrices/lll.py#L85 > > On Thu, 17 Oct 2024 at 04:00, robert....@gmail.com > <robert.w.bl...@gmail.com> wrote: > > > > Hi everyone, > > > > I'm trying to use the new-ish LLL implementation for domain matrices, but > > it's failing assertions in some of my use cases. Specifically, when the > > input matrix has really big integers in it. > > > > Here's an example from a recent session: > > > > In [2]: r = sp.sqrt(2).evalf(100) > > > > In [3]: v = [[1, 0, 0, sp.floor(10**100 * r**2)]] > > > > In [4]: v += [[0, 1, 0, sp.floor(10**100 * r**1)]] > > > > In [5]: v += [[0, 0, 1, sp.floor(10**100)]] > > > > In [6]: m = DomainMatrix.from_list(v, ZZ) > > ... > > In [8]: m.lll() > > ... > > assert all([mu_small(i, j) for i in range(m) for j in range(i)]) > > AssertionError: > > > > Here, m has integers with ~100 digits, and for some reason the > > implementation does not actually reduce the Gram-Schmidt coefficients mu to > > be less than 1/2 in absolute value. It does it perfectly if the entries of > > m have ~5 or ~10 digits. > > > > Am I doing something stupid here, or does the implementation need fixing? > > > > Robert > > > > -- > > You received this message because you are subscribed to the Google Groups > > "sympy" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to sympy+unsubscr...@googlegroups.com. > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/sympy/695ef34e-ea30-495e-af4d-ffe29c5a71a0n%40googlegroups.com. > > -- > You received this message because you are subscribed to a topic in the Google > Groups "sympy" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sympy/rkoXWBw-oY4/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAHVvXxSeUGPkQ2FL5rLA3XoFW78fzD1it3FoJ3c%2B4nOHTAVHQw%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAPcAOVa7On%3DqjtPBBm6r2nrVGZbLSY%2B1-iU_h-BWdvgzAv4JLg%40mail.gmail.com.