diff options
author | dos-reis <gdr@axiomatics.org> | 2011-03-12 19:17:32 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-03-12 19:17:32 +0000 |
commit | c93e84048964194e5674e859d6bd8827010f09f6 (patch) | |
tree | 407ca23d232bf3f974550fce0175c49495ef49c0 /src/algebra/moddfact.spad.pamphlet | |
parent | 52fddea19454dc2b9bcb54c6edd5a4cd4f5765a9 (diff) | |
download | open-axiom-c93e84048964194e5674e859d6bd8827010f09f6.tar.gz |
* src/algebra/: Systematically use negative? when comparing for
greater than 0.
Diffstat (limited to 'src/algebra/moddfact.spad.pamphlet')
-rw-r--r-- | src/algebra/moddfact.spad.pamphlet | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/algebra/moddfact.spad.pamphlet b/src/algebra/moddfact.spad.pamphlet index dc68773e..14795411 100644 --- a/src/algebra/moddfact.spad.pamphlet +++ b/src/algebra/moddfact.spad.pamphlet @@ -103,7 +103,7 @@ ModularDistinctDegreeFactorizer(U):C == T where exptmod(u1,i,u2) == negative? i => error("negative exponentiation not allowed for exptMod") ans:= 1$EMR - while i > 0 repeat + while positive? i repeat if odd?(i) then ans:= (ans * u1) rem u2 i:= i quo 2 u1:= (u1 * u1) rem u2 @@ -116,14 +116,14 @@ ModularDistinctDegreeFactorizer(U):C == T where ddfactor(u) == if (c:= lc(u)) ~= 1$I then u:= makeMonic(u) ans:= sepfact(ddfact(u)) - cons(c::EMR,[makeMonic(f) for f in ans | degree(f) > 0]) + cons(c::EMR,[makeMonic(f) for f in ans | positive? degree(f)]) gcd(u,v,q) == gcd(reduce(u,q),reduce(v,q))::U factor(u,q) == v:= reduce(u,q) dv:= reduce(differentiate(u),q) - degree gcd(v,dv) > 0 => + positive? degree gcd(v,dv) => error("Modular factor: polynomial must be squarefree") ans:= ddfactor v [f::U for f in ans] @@ -138,7 +138,7 @@ ModularDistinctDegreeFactorizer(U):C == T where repeat w:= exptmod(w,p,u) g:= gcd(w - m,u) - if degree g > 0 then + if positive? degree g then g:= makeMonic(g) ans:= [[g,d],:ans] u:= (u quo g) @@ -179,7 +179,7 @@ ModularDistinctDegreeFactorizer(U):C == T where x:U:= monomial(1,1) -- for small primes find linear factors by exhaustion d=1 and p < 1000 => - for i in 0.. while du > 0 repeat + for i in 0.. while positive? du repeat if u(i::U) = 0 then ans := cons(reduce(x-(i::U),p),ans) du := du-1 @@ -230,7 +230,7 @@ ModularDistinctDegreeFactorizer(U):C == T where p:=modulus(t) d:= d - 1 tt:=t - while d > 0 repeat + while positive? d repeat tt:= (tt + (t:=exptmod(t,p,u))) rem u d:= d - 1 tt |