If you pip install python-flint then it will be used to make some things in SymPy faster. Compare e.g. this with python-flint installed vs not installed:
In [2]: %time p = Poly(x + 1)**1000 CPU times: user 202 ms, sys: 88 μs, total: 202 ms Wall time: 200 ms In [3]: %time r = p.factor_list() CPU times: user 42.6 s, sys: 3.9 ms, total: 42.6 s Wall time: 42.6 s With python-flint: In [3]: %time p = Poly(x + 1)**1000 CPU times: user 1.99 ms, sys: 172 μs, total: 2.17 ms Wall time: 2.19 ms # 100x faster In [4]: %time r = p.factor_list() CPU times: user 35.1 ms, sys: 0 ns, total: 35.1 ms Wall time: 35.1 ms # 1000x faster This is the result of using python-flint which wraps the FLINT library: https://python-flint.readthedocs.io/en/latest/ https://flintlib.org/ This is still a work in progress. I expect that the next SymPy release will use python-FLINT for multivariate polynomials which will make a more noticeable difference and will mean that it is used for polynomial domain elements and therefore many matrix operations as well. The initial PR for multivariate polynomials does not have any actual content in it yet: https://github.com/sympy/sympy/pull/26793 A lot of upstream progress has happened though: https://github.com/flintlib/python-flint/pull/132 https://github.com/flintlib/python-flint/pull/164 https://github.com/flintlib/python-flint/pull/190 https://github.com/flintlib/python-flint/pull/191 https://github.com/flintlib/python-flint/pull/192 https://github.com/flintlib/python-flint/pull/216 https://github.com/flintlib/python-flint/pull/225 There are many more features in FLINT and python-flint that are not yet used in SymPy as well that can speed up all sorts of things like Arb to speed up evalf and so on. -- Oscar On Tue, 8 Oct 2024 at 20:33, Jason Moore <[email protected]> wrote: > > Dear Tilo, > > This has been attempted several times throughout the history of SymPy, some > with more success than others: > > https://github.com/pearu/sympycore > > https://github.com/certik/sympyx > > https://github.com/symengine/symengine > > https://github.com/oscarbenjamin/rust_protosym > > > Jason > moorepants.info > +01 530-601-9791 > > > On Tue, Oct 8, 2024 at 5:41 PM Tilo RC <[email protected]> wrote: >> >> Hi all, >> >> Just out of curiosity I was wondering if core functionality of SymPy could >> be implemented in C/C++ or some other fast language. I would imagine this >> would greatly improve speed. >> >> Is there some benefit to using Python for everything? >> >> Sincerely, >> >> Tilo >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/a8389e50-818c-4011-8018-597f6b3db6b0n%40googlegroups.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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAP7f1AjzMvJrj40cwOOLeF%2BQSo0gM87dBWjhzxRhki29JL_Jhg%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxT6OsEa7NS_RFDesMJQbZgLTQ0T5vN9DjN2aAzJLmWQsw%40mail.gmail.com.
