/usr/share/axiom-20170501/src/algebra/IBPTOOLS.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 | )abbrev package IBPTOOLS IntegralBasisPolynomialTools
++ Author: Clifton Williamson
++ Date Created: 13 August 1993
++ Date Last Updated: 17 August 1993
++ Description:
++ IntegralBasisPolynomialTools provides functions for mapping functions
++ on the coefficients of univariate and bivariate polynomials.
IntegralBasisPolynomialTools(K,R,UP,L) : SIG == CODE where
K : Ring
R : UnivariatePolynomialCategory K
UP : UnivariatePolynomialCategory R
L : Ring
MAT ==> Matrix
SUP ==> SparseUnivariatePolynomial
SIG ==> with
mapUnivariate : (L -> K,SUP L) -> R
++ mapUnivariate(f,p(x)) applies the function \spad{f} to the
++ coefficients of \spad{p(x)}.
mapUnivariate : (K -> L,R) -> SUP L
++ mapUnivariate(f,p(x)) applies the function \spad{f} to the
++ coefficients of \spad{p(x)}.
mapUnivariateIfCan : (L -> Union(K,"failed"),SUP L) -> Union(R,"failed")
++ mapUnivariateIfCan(f,p(x)) applies the function \spad{f} to the
++ coefficients of \spad{p(x)}, if possible, and returns
++ \spad{"failed"} otherwise.
mapMatrixIfCan : (L -> Union(K,"failed"),MAT SUP L) -> Union(MAT R,"failed")
++ mapMatrixIfCan(f,mat) applies the function \spad{f} to the
++ coefficients of the entries of \spad{mat} if possible, and returns
++ \spad{"failed"} otherwise.
mapBivariate : (K -> L,UP) -> SUP SUP L
++ mapBivariate(f,p(x,y)) applies the function \spad{f} to the
++ coefficients of \spad{p(x,y)}.
CODE ==> add
mapUnivariate(f:L -> K,poly:SUP L) ==
ans : R := 0
while not zero? poly repeat
ans := ans + monomial(f leadingCoefficient poly,degree poly)
poly := reductum poly
ans
mapUnivariate(f:K -> L,poly:R) ==
ans : SUP L := 0
while not zero? poly repeat
ans := ans + monomial(f leadingCoefficient poly,degree poly)
poly := reductum poly
ans
mapUnivariateIfCan(f,poly) ==
ans : R := 0
while not zero? poly repeat
(lc := f leadingCoefficient poly) case "failed" => return "failed"
ans := ans + monomial(lc :: K,degree poly)
poly := reductum poly
ans
mapMatrixIfCan(f,mat) ==
m := nrows mat; n := ncols mat
matOut : MAT R := new(m,n,0)
for i in 1..m repeat for j in 1..n repeat
(poly := mapUnivariateIfCan(f,qelt(mat,i,j))) case "failed" =>
return "failed"
qsetelt_!(matOut,i,j,poly :: R)
matOut
mapBivariate(f,poly) ==
ans : SUP SUP L := 0
while not zero? poly repeat
ans :=
ans + monomial(mapUnivariate(f,leadingCoefficient poly),degree poly)
poly := reductum poly
ans
|