On Mon, Mar 30, 2026 at 8:19 PM Nils Bruin <[email protected]> wrote:
>
> For such high powers you may well be better off first computing the Jordan 
> Normal Form of the matrix. Then you only need to take extremely high powers 
> of diagonal matrices, which is *way* faster. It can easily be worth the cost 
> of the base field extension.
>
Matrix power M^m can be computed in O(n^3 \log_2(m)) with repeated squaring.

sage: N=100;p=next_prime(2^200);Kq=GF(p)
sage: M1=randmat(N,Kq)
sage: M1gp=gp(M1)
sage: %time tt=M1gp^(2)
CPU times: user 3.56 ms, sys: 1.08 ms, total: 4.64 ms
Wall time: 58.4 ms
sage: %time tt=M1gp^(2^30+1)
CPU times: user 1.55 ms, sys: 3.59 ms, total: 5.14 ms
Wall time: 1.28 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/CAGUWgD94uKK6%2BCLY5vxD0%3DKBFLKW%3DJJsJTQsfQB0o%2BV-5W8tnA%40mail.gmail.com.

Reply via email to