diff options
author | Gabriel Dos Reis <gdr@axiomatics.org> | 2016-01-17 22:53:01 -0800 |
---|---|---|
committer | Gabriel Dos Reis <gdr@axiomatics.org> | 2016-01-17 22:53:01 -0800 |
commit | d07fc9735f40e545edda456e15dbab783c500f6a (patch) | |
tree | 4d9fab82a7085b73a4b00d23389935503fdfc90d /src/algebra/newpoly.spad.pamphlet | |
parent | 5437d438937eb25eb320fef6e4fd6ebc91ca6dc9 (diff) | |
download | open-axiom-d07fc9735f40e545edda456e15dbab783c500f6a.tar.gz |
subtractIfCan$CancellationAbelianMonoid: return the more principled Maybe %
Diffstat (limited to 'src/algebra/newpoly.spad.pamphlet')
-rw-r--r-- | src/algebra/newpoly.spad.pamphlet | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/algebra/newpoly.spad.pamphlet b/src/algebra/newpoly.spad.pamphlet index 65bdcde7..d695d8ee 100644 --- a/src/algebra/newpoly.spad.pamphlet +++ b/src/algebra/newpoly.spad.pamphlet @@ -120,7 +120,7 @@ NewSparseUnivariatePolynomial(R): Exports == Implementation where e := yy.first.k; y := per(yy.rest) -- while (not empty? xx) repeat repeat - if (u:=subtractIfCan(xx.first.k,e)) case "failed" then break + if (u:=subtractIfCan(xx.first.k,e)) case nothing then break xx:= rep fmecg(per rest(xx), u, xx.first.c, y) if empty? xx then break per xx @@ -134,7 +134,7 @@ NewSparseUnivariatePolynomial(R): Exports == Implementation where empty? xx => [x, co, 0] pow: NNI := 0; e := yy.first.k; y := per(yy.rest); repeat - if (u:=subtractIfCan(xx.first.k,e)) case "failed" then break + if (u:=subtractIfCan(xx.first.k,e)) case nothing then break xx:= rep fmecg(co * per rest(xx), u, xx.first.c, y) pow := pow + 1 if empty? xx then break @@ -151,7 +151,7 @@ NewSparseUnivariatePolynomial(R): Exports == Implementation where (co = -1) => - monicModulo(-x,-y) xx:= rep x; e := yy.first.k; y := per(yy.rest) repeat - if (u:=subtractIfCan(xx.first.k,e)) case "failed" then break + if (u:=subtractIfCan(xx.first.k,e)) case nothing then break xx:= rep fmecg(co * per rest(xx), u, xx.first.c, y) if empty? xx then break per xx @@ -167,7 +167,7 @@ NewSparseUnivariatePolynomial(R): Exports == Implementation where pow: NNI := subtractIfCan(xx.first.k,e)::NNI + 1 qq: Rep := []; y := per(yy.rest) repeat - if (u:=subtractIfCan(xx.first.k,e)) case "failed" then break + if (u:=subtractIfCan(xx.first.k,e)) case nothing then break qq := cons([u::NNI, xx.first.c]$Term, rep (co * per qq)) xx := rep fmecg(co * per rest(xx), u, xx.first.c, y) pow := subtractIfCan(pow,1)::NNI @@ -183,7 +183,7 @@ NewSparseUnivariatePolynomial(R): Exports == Implementation where (empty? xx) or (xx.first.k < e) => 0 qq: Rep := []; co := yy.first.c; y := per(yy.rest) repeat - if (u:=subtractIfCan(xx.first.k,e)) case "failed" then break + if (u:=subtractIfCan(xx.first.k,e)) case nothing then break qq := cons([u::NNI, xx.first.c]$Term, rep (co * per qq)) xx := rep fmecg(co * per rest(xx), u, xx.first.c, y) if empty? xx then break @@ -236,7 +236,7 @@ NewSparseUnivariatePolynomial(R): Exports == Implementation where pow: NNI := subtractIfCan(xx.first.k,e)::NNI + 1 qq: Rep := []; y := per(yy.rest) repeat - if (u:=subtractIfCan(xx.first.k,e)) case "failed" then break + if (u:=subtractIfCan(xx.first.k,e)) case nothing then break qq := cons([u::NNI, xx.first.c]$Term, rep (co * per qq)) xx := rep fmecg(co * per rest(xx), u, xx.first.c, y) pow := subtractIfCan(pow,1)::NNI @@ -257,7 +257,7 @@ NewSparseUnivariatePolynomial(R): Exports == Implementation where pow: NNI := subtractIfCan(xx.first.k,e)::NNI + 1 qq: Rep := []; co := yy.first.c; y := per(yy.rest) repeat - if (u:=subtractIfCan(xx.first.k,e)) case "failed" then break + if (u:=subtractIfCan(xx.first.k,e)) case nothing then break qq := cons([u::NNI, xx.first.c]$Term, rep (co * per qq)) xx := rep fmecg(co * per rest(xx), u, xx.first.c, y) pow := subtractIfCan(pow,1)::NNI |