On Sat, Mar 28, 2026 at 4:02 PM Fredrik Johansson <[email protected]> wrote: > > 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 >
Thanks. What code are you doing for benchmarking? Both on my boxen and sagecell the obvious implementation is slower. What do you get for the following code? Session on sagecell: def randmat(N,K): return Matrix(K,N,N,[K.random_element() for _ in range(N^2)]) N=200 set_random_seed(1) Kq=GF(next_prime(2^200)) M1=randmat(N,Kq) %time MsZZ=M1.change_ring(ZZ)^2 #Wall time: 145 ms %time Msqu=M1^2 #Wall time: 10.6 s -- 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/CAGUWgD_YN7jDXXK_GNMn7Cutmj_drC8WAPF%2B24xfTofUTrVmFQ%40mail.gmail.com.
