What is the advantage of using this python/flint?

On Sunday, March 29, 2026 at 10:51:09 AM UTC-4 [email protected] wrote:

>
>
> On March 29, 2026 8:37:54 AM CDT, 'Trevor Karn' via sage-devel <
> [email protected]> wrote:
> >What is the general procedure for implementing an interface with flint?
>
> Basically, adding more cython code.
>
> But perhaps Sage can switch to using 
> <https://github.com/flintlib/python-flint/>?
>
>
> >
> >On Saturday, March 28, 2026 at 4:43:11 PM UTC-4 vdelecroix wrote:
> >
> >> I confirm Fredrik diagnostic
> >>
> >> sage: type(M1)
> >> <class 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>
> >>
> >> It is a pity that flint fmpz_mod_mat and mpn_mod_mat are not
> >> interfaced (and used) in Sagemath!
> >>
> >> On Sat, 28 Mar 2026 at 15:02, Fredrik Johansson
> >> <[email protected]> wrote:
> >> >
> >> > On Saturday, March 28, 2026 at 11:53:40 AM UTC+1 Georgi Guninski 
> wrote:
> >> >
> >> > I believed that matrix multiplication and squaring to be significantly
> >> > faster over GF(p) instead over ZZ.
> >> >
> >> >
> >> > Numerical evidence supports the opposite, is it a bug or reality?
> >> >
> >> > Session:
> >> >
> >> > def randmat(N,K): return Matrix(K,N,N,[K.random_element() for _ in 
> >> range(N^2)])
> >> > N=200
> >> > Kq=GF(next_prime(2^200))
> >> > M1=randmat(N,Kq)
> >> > %time MsZZ=M1.change_ring(ZZ)^2 #Wall time: 188 ms
> >> > %time Msqu=M1^2 #Wall time: 7.75 s
> >> >
> >> >
> >> > I would expect matrix multiplication to be around as fast over GF(p) 
> and 
> >> ZZ if the entries are the same. Large-p GF(p) matrices being a lot 
> slower 
> >> in Sage is surely because they use a generic matrix implementation 
> rather 
> >> than a specialized one.
> >> >
> >> > With current FLINT on my machine squaring a 200x200 matrix with 
> 200-bit 
> >> entries costs as follows:
> >> >
> >> > 0.032 seconds over ZZ with fmpz_mat
> >> > 0.035 seconds over GF(p) with fmpz_mod_mat
> >> > 0.029 seconds over GF(p) with mpn_mod_mat
> >> >
> >> > Fredrik
> >> >
> >> >
> >> > --
> >> > 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 [email protected].
> >> > To view this discussion visit 
> >> 
> https://groups.google.com/d/msgid/sage-devel/5bd108cd-ca0c-4b45-8193-dc1f51b010e2n%40googlegroups.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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/aef5cb09-5da6-4595-bb57-b3191767fd70n%40googlegroups.com.

Reply via email to