Commit 35fb419e authored by Emmanuel Thomé's avatar Emmanuel Thomé

oh j'ai vu passer une chaine d'addition

parent c0497b20
......@@ -70,14 +70,19 @@ cyclo_s16 = 2*cost_s(8)
def cost_prenorm(k,ell):
# returns the cost of computing
# prenorm_{j,\ell}(a)=a^(1+p^j+...+p^{j*(ell-1)})
# in F_p^k, where ell is a divisor of k-1. This is used only for k
# odd. (we have norm(a) = a * prenorm_{1,k-1}(a^p) )
# in F_p^k. This is used only for k odd.
# (we have norm(a) = a * prenorm_{1,k-1}(a^p) )
# Note that the cost is independent of j.
if ell == 1:
return 0
elif is_prime(ell):
return cost_m(k) + cost_f(k) + cost_prenorm(k, ell-1)
else:
# It's not necessarily the best strategy. E.g. for k=67, we're
# led to compute prenorm for ell=33 (ell=66 at first, but let's
# focus on the sub call). That is in fact best done by going to
# 32 first (cost F+M, then 5F+5M). In contrast, the factoring
# approach below costs 7F+7M...
mu = factor(ell)[0][0]
return cost_prenorm(k, mu) + cost_prenorm(k, ell // mu)
# prenorm_{j,u*v}(a) = prenorm_{j*v,u}(prenorm_{j,v}(a))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment