Skip to content

Commit

Permalink
Add more explicit imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Waldek Hebisch committed Jul 22, 2024
1 parent d16d0c7 commit c3380e9
Show file tree
Hide file tree
Showing 23 changed files with 77 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-07-23 Waldek Hebisch <[email protected]>

* src/algebra/*: Add more explicit imports

2024-07-21 Frederic Chapoton

* src/*: Spelling fixes
Expand Down
11 changes: 11 additions & 0 deletions src/algebra/alg_top.spad
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ FacetCategory() : Category == Definition where

add

import from NNI

-- is empty if it contains no vertices or if multiplier is zero
empty?(orf : %) : Boolean ==
if order(orf) = 0 then return true
Expand Down Expand Up @@ -1004,6 +1006,9 @@ CubicalFacet() : Exports == Impl where
-- treat it as an integer.
Rep := Record(mul : Integer, fac : List(Segment(Integer)))

import from Integer
import from List(Segment(Integer))

-- Constructor for cubical facet
-- intervals are always stored in low..high order
-- orientation is calculated by the number of intervals that have
Expand Down Expand Up @@ -1401,6 +1406,8 @@ ChainComplex() : Exports == Impl where

transition_matrices(a : %) : List(Matrix(Integer)) == a::Rep

import from PrintPackage

-- true if this is a valid chain complex, that is:
-- 1) maps compose
-- 2) product of adjacent maps is zero
Expand Down Expand Up @@ -1544,6 +1551,8 @@ CoChainComplex(VS : AbelianGroup) : Exports == Impl where
tm := reverse!(tm)
map(transpose, tm)

import from PrintPackage

-- true if this is a valid cochain complex, that is:
-- 1) maps compose
-- 2) product of adjacent maps is zero
Expand Down Expand Up @@ -2531,6 +2540,8 @@ FiniteCubicalComplex(VS : AbelianGroup) : Exports == Impl where

Impl ==> add

import from List(Segment(Integer))

-- Representation holds whole Cubical Complex. This consists of
-- a vertex set, here represented as a vertex list so that we can
-- index it.
Expand Down
3 changes: 3 additions & 0 deletions src/algebra/algfact.spad
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ AlgFactor(UP) : Exports == Implementation where
liftpoly : UPQ -> UP
irred? : UP -> Boolean

import from List(AN)
import from Factored(UP)

liftpoly p == map(x +-> x::AN, p)$UPCF2(Q, UPQ, AN, UP)
downpoly p == map(x +-> retract(x)@Q, p)$UPCF2(AN, UP , Q, UPQ)
ifactor(p, l) == (fact(p pretend UP, l)) pretend Factored(SUP)
Expand Down
6 changes: 6 additions & 0 deletions src/algebra/algfunc.spad
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ AlgebraicFunction(R, F) : Exports == Implementation where
belong? op == has?(op, ALGOP) or is?(op, '%root_sum)
dalg l == second(l)::OutputForm

import from UP
import from Fraction(UP)
import from Integer
import from SparseMultivariatePolynomial(R, Kernel(F))
import from List(F)

rootOf(p, x) ==
k := kernel(x)$K
(r := retractIfCan(p)@Union(F, "failed")) case "failed" =>
Expand Down
2 changes: 2 additions & 0 deletions src/algebra/charpol.spad
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ CharacteristicPolynomial3(R : IntegralDomain) : Exports == Implementation where

Implementation ==> add

import from F

char_pol_via_interpolation0(m : Mat, ld : List(R)) : UpF ==
n := ncols(m)
n ~= nrows(m) => error "matrix not square"
Expand Down
4 changes: 4 additions & 0 deletions src/algebra/combfunc.spad
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ CombinatorialFunction(R, F) : Exports == Implementation where

Implementation ==> add

import from List(Symbol)
import from BasicOperator
import from Segment(F)

COMB := 'comb

ifact : F -> F
Expand Down
8 changes: 8 additions & 0 deletions src/algebra/constant.spad
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ AlgebraicNumber() : Exports == Implementation where
makeUnivariate(p : P, k : Kernel %) : SUP % ==
map(x +-> x::%,
univariate(p, k))$SparseUnivariatePolynomialFunctions2(P, %)

import from P
import from List(K)
import from Fraction(Z)

-- public
a, b : %
differentiate(x : %) : % == 0
Expand Down Expand Up @@ -148,13 +153,16 @@ AlgebraicNumber() : Exports == Implementation where
coerceToType(convert(x pretend Rep)$Rep)$InputFormFunctions1(%)

convert(x : %) : Float ==
import from Expression(Float)
retract map(y +-> y::Float, x pretend FE)$ExpressionFunctions2(Z, Float)

convert(x : %) : DoubleFloat ==
import from Expression(DoubleFloat)
retract map(y +-> y::DoubleFloat,
x pretend FE)$ExpressionFunctions2(Z, DoubleFloat)

convert(x : %) : Complex(Float) ==
import from Expression(Complex(Float))
retract map(y +-> y::Complex(Float),
x pretend FE)$ExpressionFunctions2(Z, Complex Float)

Expand Down
1 change: 1 addition & 0 deletions src/algebra/contfrac.spad
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ ContinuedFraction(R) : Exports == Implementation where
Rep := Record(value : Record(whole : R, fract : Str), reduced? : Boolean)

import from Str
import from Stream(Q)

genFromSequence : Stream Q -> %
genReducedForm : (Q, Stream Q, MT) -> Stream Rec
Expand Down
2 changes: 2 additions & 0 deletions src/algebra/cra.spad
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ CRApackage(R : EuclideanDomain) : Exports == Implementation where
++ multiEuclideanTree(l, r) \undocumented{}
Implementation == add

import from Integer

BB := BalancedBinaryTree(R)
x : BB

Expand Down
1 change: 1 addition & 0 deletions src/algebra/crfp.spad
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ ComplexRootFindingPackage(R, UP) : public == private where

private ==> add

import from List(UP)

Rep := ModMonic(C, UP)

Expand Down
2 changes: 2 additions & 0 deletions src/algebra/cycles.spad
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ CycleIndicators : Exports == Implementation where
Implementation ==> add
import from PartitionsAndPermutations
import from IntegerNumberTheoryFunctions
import from Factored(Integer)
import from Fraction(Integer)

trm : PTN -> SPOL RN
trm pt == monomial(inv(pdct(pt) :: RN), pt)
Expand Down
2 changes: 2 additions & 0 deletions src/algebra/cyclo.spad
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ CyclotomicUtilities : Exports == Implementation where

Implementation ==> add

import from Factored(Integer)

lU ==> Union(List(Integer), "failed")

recursive_check_even : (pA, Integer, Integer, Integer,
Expand Down
6 changes: 6 additions & 0 deletions src/algebra/cyldec.spad
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ CylindricalAlgebraicDecompositionUtilities(R, P) : PUB == PRIV where

PRIV == add

import from Integer

gcdBasisAdd : (P, List(P)) -> List(P)
-- add one polynomial to list of pairwise relatively prime polynomials

Expand Down Expand Up @@ -212,6 +214,8 @@ Cell(TheField) : PUB == PRIV where

RepT ==> List(SCELL)

import from SCELL

simpleCells(c) == c pretend RepT

Rep := RepT
Expand Down Expand Up @@ -322,6 +326,8 @@ CylindricalAlgebraicDecompositionPackage(TheField) : PUB == PRIV where
PACK1 ==> CylindricalAlgebraicDecompositionUtilities(ThePols, RUP)
PACK2 ==> CylindricalAlgebraicDecompositionUtilities(TheField, BUP)

import from Integer

specialise(lpols, cell) ==
lpols = [] => error("specialise: empty list of pols")
sp := samplePoint(cell)
Expand Down
6 changes: 6 additions & 0 deletions src/algebra/fmt.spad
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,12 @@ of a \spad{ROW} operator without the wrapping \spad{MATRIX} operator.
minPrecedence(): Z == 0
maxPrecedence(): Z == 10000

import from Character
import from Symbol
import from Integer
import from List(OutputForm)
import from String

numberOfPrimes(a2: E): Z == -- second argument of a PRIME expression
import from OutputFormTools
atom? a2 => -- Is should be a number of commas.
Expand Down
1 change: 1 addition & 0 deletions src/algebra/gaussian.spad
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ ComplexPatternMatch(R, S, CS) : C == T where
import from PatternMatchPushDown(R, S, CS)
import from PatternMatchResultFunctions2(R, PS, CS)
import from PatternMatchResultFunctions2(R, CS, PS)
import from Integer

ivar : PS := '%i::PS

Expand Down
2 changes: 2 additions & 0 deletions src/algebra/jet.spad
Original file line number Diff line number Diff line change
Expand Up @@ -4812,6 +4812,8 @@ CartanKuranishi(JB : JBC, D : JBFC) : Cat == Def where

remember : Table(NREC, NNI) := dictionary()

import from List(NNI)

stirling(i : NNI, k : NNI, q : NNI) : NNI ==
-- Evaluates the symmetric polynomial of degree k in i variables
-- for the values q+1, ..., q+i.
Expand Down
4 changes: 4 additions & 0 deletions src/algebra/logic.spad
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ Poset(S) : Category == Definition where
++ \url{http://www.euclideanspace.com/prog/scratchpad/mycode/discrete/logic/moebius/}

add
import from List(S)
import from List(List(Boolean))

-- adds an object to this poset
addObject!(s : %, n : S) : % ==
Expand Down Expand Up @@ -4134,6 +4136,8 @@ BitStreamFrame() : Exports == Impl where

hash(s : %) : SingleInteger == 0$SingleInteger

import from Integer

-- returns true if x equals y
-- this is equality and not isomorphism
-- that is it returns true only if exact index values and names are used
Expand Down
2 changes: 2 additions & 0 deletions src/algebra/mkfunc.spad
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ InputForm():
'LET)@%, a, conv(concat(first l,
[u.symb for u in l2]))@%]$List(%))@%), a]

import from Symbol

strsym s ==
string? s => string s
symbol? s => string symbol s
Expand Down
2 changes: 2 additions & 0 deletions src/algebra/naalg.spad
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ AlgebraGivenByStructuralConstants(R : CommutativeRing, n : PositiveInteger, _
v(i) := x(i)
directProduct(v)

import from OV

construct(l : List(Term)) : % ==
v : Vector R := new(n, 0)
for el in l repeat
Expand Down
1 change: 1 addition & 0 deletions src/algebra/numsolve.spad
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ComplexRootPackage(UP, Par) : T == C where
C == add

import from Factored(UP)
import from Factored(SparseUnivariatePolynomial(Complex(Integer)))

complexZeros(p : UP, eps : Par) : List CP ==
x1 : Symbol() := new()
Expand Down
2 changes: 2 additions & 0 deletions src/algebra/outform.spad
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ OutputForm() : Join(SetCategory, ConvertibleTo InputForm) with
outputForm s ==
sform concat(quote()$Character, concat(s, quote()$Character))

import from Character

convert(a: %): InputForm ==
b: SExpression := a pretend SExpression
if atom?(b)$SExpression then
Expand Down
2 changes: 2 additions & 0 deletions src/algebra/sf.spad
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ DoubleFloat() : Join(FloatingPointSystem, DifferentialRing, OpenMath,
airyBiPrime(x) == airyBiPrime(sfx)$SFSFUN2 pretend %
digamma(x) == polygamma(0, sfx)$SFSFUN2 pretend %

import from DoubleFloat

polygamma(x, y) ==
if (n := retractIfCan(sfx)@Union(Integer, "failed")) case Integer _
and n >= 0 then
Expand Down
3 changes: 3 additions & 0 deletions src/algebra/tree.spad
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ BinaryTree(S : SetCategory) : Exports == Implementation where
empty? t => error "binaryTree:no value to set"
setvalue!(first(t::Rep), nd)
nd

import from Tree(S)

setleft!(t1, t2) ==
empty? t1 => error "binaryTree:no left to set"
setchildren!(first(t1::Rep), t2::Rep)
Expand Down

0 comments on commit c3380e9

Please sign in to comment.