-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It uses mpz_remove to compute the p-valuation. In fact, it computes arbitrary g-valuations, i.e. the second argument can be an arbitrary nonzero integer. We also adapt PValuation to use PVALUATION_INT, and the Valuation method for integers. For small inputs, there is little difference, but for larger ones we get a noticeable speedup. To illustrate this, here are some examples, where ps:=[2,3,5,7,251,65537]; lwi:=ListWithIdenticalEntries;; Old code: gap> x:=2^20;; ListX(lwi(10000,x),ps,PValuation);; time; 90 gap> x:=2^1000-1;; ListX(lwi(10000,x),ps,PValuation);; time; 79 gap> x:=2^1000;; ListX(lwi(10000,x),ps,PValuation);; time; 2608 gap> x:=2^1000+1;; ListX(lwi(10000,x),ps,PValuation);; time; 56 gap> x:=2^1000+2^100;; ListX(lwi(10000,x),ps,PValuation);; time; 379 New code: gap> x:=2^20;; ListX(lwi(10000,x),ps,PValuation);; time; 40 gap> x:=2^1000-1;; ListX(lwi(10000,x),ps,PValuation);; time; 86 gap> x:=2^1000;; ListX(lwi(10000,x),ps,PValuation);; time; 64 gap> x:=2^1000+1;; ListX(lwi(10000,x),ps,PValuation);; time; 71 gap> x:=2^1000+2^100;; ListX(lwi(10000,x),ps,PValuation);; time; 67 Using PVALUATION_INT directly (returns 0 for n=0, and only supports integer inputs): gap> x:=2^20;; ListX(lwi(10000,x),ps,PVALUATION_INT);; time; 26 gap> x:=2^1000-1;; ListX(lwi(10000,x),ps,PVALUATION_INT);; time; 67 gap> x:=2^1000;; ListX(lwi(10000,x),ps,PVALUATION_INT);; time; 47 gap> x:=2^1000+1;; ListX(lwi(10000,x),ps,PVALUATION_INT);; time; 53 gap> x:=2^1000+2^100;; ListX(lwi(10000,x),ps,PVALUATION_INT);; time; 49
- Loading branch information
Showing
5 changed files
with
74 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters