I am computing powers of matrices over the integers,
but will prefer to work over finite fields or finite rings,
first to avoid large integers and second to run faster.

Experimentally powers over the integers are faster than
finite rings and fields.

Can I do something to preserve efficiently and avoid large integers?

session:

sage: n=200;l=list(range(n**2))
sage: p=next_prime(2**30)
sage: M1=Matrix(ZZ,n,n,l)
sage: M2=Matrix(Integers(p),n,n,l)
sage: M3=Matrix(GF(p),n,n,l)
sage: time a=M1**n
CPU times: user 1.97 s, sys: 36.3 ms, total: 2.01 s
Wall time: 2.09 s
sage: time a=M2**n
CPU times: user 11 s, sys: 12 ms, total: 11 s
Wall time: 11.2 s
sage: time a=M3**n
CPU times: user 11.1 s, sys: 5.96 ms, total: 11.1 s
Wall time: 11.3 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 sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAGUWgD9syfnCd2SKw%3DyZ-wydxutQwYSbVvuFF%3DvyS_bmiwFmLw%40mail.gmail.com.

Reply via email to