## Find the average times to compute sums of Witt vectors over ## finite fields with two methods: ## * precompute the formulas and then evaluate ## (disregard time to compute the formulas) ## * use recursion load 'witt2_fun.sage' p=101 time vecS=WittSum2Pol(p) n=20 F.=GF(p^n) tms1=[] tms2=[] tms3=[] ntry=7 for i in range(ntry): v1=[F.random_element(),F.random_element(),F.random_element()] v2=[F.random_element(),F.random_element(),F.random_element()] t1=cputime() tmp1=WittSum2(v1,v2) tms1+=[cputime(t1)] # print tms1 ## t2=cputime() ## tmp2=WittSum22(v1,v2,vecS=vecS) ## tms2+=[cputime(t2)] ## # print tms2 ## if tmp1 != tmp2: ## print "ERROR" print tms1 ## print tms2 print "NEW = ", sum(tms1)/ntry ## print "OLD = ", sum(tms2)/ntry ## 31^4 gives ## NEW = 1.5967072 ## OLD = 192.68120825 ## 11^15 gives: ## NEW = 0.2816569 ## OLD = 4.1877635 ## 13^7 gives: ## NEW = 0.2708089 ## OLD = 5.19256065 ## 23^10 gives: ## NEW = 1.1674726 ## OLD = 88.3461193 ## 41^4 gives: ## NEW = 3.11052714286 ## OLD = 782.754431571 ## 53^4 gives: ## NEW = 4.95324714286 ## OLD = 1959.46640129 ## 61^4 gives: ## NEW = 6.99236542857 ## OLD = 3509.91769729 ## 101^20 gives: ## NEW = 61.3173925714