Flint also has dense matrices over rings in general, so one can use any Flint ring, not only Z mod n.
On Thu, 15 Jun 2023, 14:07 Edgar Costa, <edgardiasco...@gmail.com> wrote: > Indeed, that is what we should use for single-word modulus. > I think David and I wrote a wrapper at some point, but then we did not use > it? > > On Thu, Jun 15, 2023 at 8:26 AM Dima Pasechnik <dimp...@gmail.com> wrote: > >> Flint has matrices mod n, see https://flintlib.org/doc/nmod_mat.html >> I guess they should be fast - but they need Sage interface to be provided. >> >> On Thu, Jun 15, 2023 at 1:01 PM Georgi Guninski <ggunin...@gmail.com> >> wrote: >> > >> > On Wed, Jun 14, 2023 at 8:15 PM David Roe <roed.m...@gmail.com> wrote: >> > > >> > > Another possibility would be to change the __pow__ method for >> integer matrices to not ignore the modulus argument. As a workaround you >> can either use pari (as you discovered), or use an integer matrix and >> occasionally reduce the coefficients. >> > >> > I implemented something very close to efficiently reduction modulo >> integers >> > when working over ZZ and probably it can implemented in __pow__(). >> > >> > check the attached file. >> > >> > sage: time M1f=matpowermodp(M,n,p) >> > CPU times: user 528 ms, sys: 2.98 ms, total: 531 ms >> > Wall time: 362 ms >> > sage: time M1s=M1p**n >> > CPU times: user 21.3 s, sys: 4.01 ms, total: 21.3 s >> > Wall time: 21.4 s >> > sage: M1s==M1f >> > True >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "sage-devel" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an email to sage-devel+unsubscr...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/sage-devel/CAGUWgD8FPZQPJ_THJnzhiS80%3D%2BjwGZYC-%2BFoG5eXNuQQc1JNQw%40mail.gmail.com >> . >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sage-devel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sage-devel+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sage-devel/CAAWYfq3-w6FFNeDpvgD84wJSHMnx9gvPoAP%3Dwf%2BhbxBYu3RzMQ%40mail.gmail.com >> . >> > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sage-devel/CA%2BiQ7x6PN9%2B2CqXN5mjcCNu2i9rdwXAM%3D2pYs09dPsOCjx4_ag%40mail.gmail.com > <https://groups.google.com/d/msgid/sage-devel/CA%2BiQ7x6PN9%2B2CqXN5mjcCNu2i9rdwXAM%3D2pYs09dPsOCjx4_ag%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq0c0GvqhLfMZ-z%3DUFPoxT3c11LmN8zJqqt672S1fL2hVw%40mail.gmail.com.