/usr/share/axiom-20170501/src/algebra/FSUPFACT.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | )abbrev package FSUPFACT FunctionSpaceUnivariatePolynomialFactor
++ Author: Manuel Bronstein
++ Date Created: 12 May 1988
++ Date Last Updated: 22 September 1993
++ Description:
++ This package is used internally by IR2F
FunctionSpaceUnivariatePolynomialFactor(R, F, UP) : SIG == CODE where
R : Join(IntegralDomain, OrderedSet, RetractableTo Integer)
F : FunctionSpace R
UP : UnivariatePolynomialCategory F
Q ==> Fraction Integer
K ==> Kernel F
AN ==> AlgebraicNumber
PQ ==> SparseMultivariatePolynomial(Q, K)
PR ==> SparseMultivariatePolynomial(R, K)
UPQ ==> SparseUnivariatePolynomial Q
UPA ==> SparseUnivariatePolynomial AN
FR ==> Factored UP
FRQ ==> Factored UPQ
FRA ==> Factored UPA
SIG ==> with
ffactor : UP -> FR
++ ffactor(p) tries to factor a univariate polynomial p over F
qfactor : UP -> Union(FRQ, "failed")
++ qfactor(p) tries to factor p over fractions of integers,
++ returning "failed" if it cannot
UP2ifCan : UP -> Union(overq: UPQ, overan: UPA, failed: Boolean)
++ UP2ifCan(x) should be local but conditional.
if F has RetractableTo AN then
anfactor : UP -> Union(FRA, "failed")
++ anfactor(p) tries to factor p over algebraic numbers,
++ returning "failed" if it cannot
CODE ==> add
import AlgFactor(UPA)
import RationalFactorize(UPQ)
P2QifCan : PR -> Union(PQ, "failed")
UPQ2UP : (SparseUnivariatePolynomial PQ, F) -> UP
PQ2F : (PQ, F) -> F
ffactor0 : UP -> FR
dummy := kernel(new()$Symbol)$K
if F has RetractableTo AN then
UPAN2F: UPA -> UP
UPQ2AN: UPQ -> UPA
UPAN2F p ==
map(x+->x::F, p)$UnivariatePolynomialCategoryFunctions2(AN,UPA,F,UP)
UPQ2AN p ==
map(x+->x::AN, p)$UnivariatePolynomialCategoryFunctions2(Q,UPQ,AN,UPA)
ffactor p ==
(pq := anfactor p) case FRA =>
map(UPAN2F, pq::FRA)$FactoredFunctions2(UPA, UP)
ffactor0 p
anfactor p ==
(q := UP2ifCan p) case overq =>
map(UPQ2AN, factor(q.overq))$FactoredFunctions2(UPQ, UPA)
q case overan => factor(q.overan)
"failed"
UP2ifCan p ==
ansq := 0$UPQ ; ansa := 0$UPA
goforq? := true
while p ^= 0 repeat
if goforq? then
rq := retractIfCan(leadingCoefficient p)@Union(Q, "failed")
if rq case Q then
ansq := ansq + monomial(rq::Q, degree p)
ansa := ansa + monomial(rq::Q::AN, degree p)
else
goforq? := false
ra := retractIfCan(leadingCoefficient p)@Union(AN, "failed")
if ra case AN then ansa := ansa + monomial(ra::AN, degree p)
else return [true]
else
ra := retractIfCan(leadingCoefficient p)@Union(AN, "failed")
if ra case AN then ansa := ansa + monomial(ra::AN, degree p)
else return [true]
p := reductum p
goforq? => [ansq]
[ansa]
else
UPQ2F: UPQ -> UP
UPQ2F p ==
map(x+->x::F, p)$UnivariatePolynomialCategoryFunctions2(Q,UPQ,F,UP)
ffactor p ==
(pq := qfactor p) case FRQ =>
map(UPQ2F, pq::FRQ)$FactoredFunctions2(UPQ, UP)
ffactor0 p
UP2ifCan p ==
ansq := 0$UPQ
while p ^= 0 repeat
rq := retractIfCan(leadingCoefficient p)@Union(Q, "failed")
if rq case Q then ansq := ansq + monomial(rq::Q, degree p)
else return [true]
p := reductum p
[ansq]
ffactor0 p ==
smp := numer(ep := p(dummy::F))
(q := P2QifCan smp) case "failed" => p::FR
map(x+->UPQ2UP(univariate(x, dummy), denom(ep)::F), factor(q::PQ
)$MRationalFactorize(IndexedExponents K, K, Integer,
PQ))$FactoredFunctions2(PQ, UP)
UPQ2UP(p, d) ==
map(x+->PQ2F(x, d), p)$UnivariatePolynomialCategoryFunctions2(PQ,
SparseUnivariatePolynomial PQ, F, UP)
PQ2F(p, d) ==
map((x:K):F+->x::F, (y:Q):F+->y::F, p)_
$PolynomialCategoryLifting(IndexedExponents K, K, Q, PQ, F) / d
qfactor p ==
(q := UP2ifCan p) case overq => factor(q.overq)
"failed"
P2QifCan p ==
and/[retractIfCan(c::F)@Union(Q, "failed") case Q
for c in coefficients p] =>
map(x+->x::PQ, y+->retract(y::F)@Q :: PQ, p)_
$PolynomialCategoryLifting(IndexedExponents K,K,R,PR,PQ)
"failed"
|