Skip to content

Commit 21fae23

Browse files
authored
_APL (#39)
1 parent ee0bdea commit 21fae23

File tree

7 files changed

+26
-23
lines changed

7 files changed

+26
-23
lines changed

src/SemialgebraicSets.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const MA = MutableArithmetics
88
using MultivariatePolynomials
99
const MP = MultivariatePolynomials
1010

11-
const APL = AbstractPolynomialLike
11+
const _APL = AbstractPolynomialLike
1212

1313
import CommonSolve: solve
1414

src/basic.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
export inequalities, basic_semialgebraic_set
22

3-
struct BasicSemialgebraicSet{T,PT<:APL{T},AT<:AbstractAlgebraicSet} <:
3+
struct BasicSemialgebraicSet{T,PT<:_APL{T},AT<:AbstractAlgebraicSet} <:
44
AbstractBasicSemialgebraicSet
55
V::AT
66
p::Vector{PT}
77
end
8-
function BasicSemialgebraicSet{T,PT}() where {T,PT<:APL{T}}
8+
function BasicSemialgebraicSet{T,PT}() where {T,PT<:_APL{T}}
99
return BasicSemialgebraicSet(AlgebraicSet{T,PT}(), PT[])
1010
end
1111
function BasicSemialgebraicSet(
1212
V::AlgebraicSet{T,PT,A,S},
1313
p::Vector{PT},
14-
) where {T,PT<:APL{T},A,S<:AbstractAlgebraicSolver}
14+
) where {T,PT<:_APL{T},A,S<:AbstractAlgebraicSolver}
1515
return BasicSemialgebraicSet{T,PT,typeof(V)}(V, p)
1616
end
1717
function BasicSemialgebraicSet(
1818
V::AlgebraicSet{T,PT,A,SO,U},
1919
p::Vector{PS},
20-
) where {T,PT<:APL{T},S,PS<:APL{S},A,SO<:AbstractAlgebraicSolver,U}
20+
) where {T,PT<:_APL{T},S,PS<:_APL{S},A,SO<:AbstractAlgebraicSolver,U}
2121
ST = promote_type(T, S)
2222
PST = promote_type(PT, PS)
2323
return BasicSemialgebraicSet(
2424
convert(AlgebraicSet{ST,PST,A,SO,U}, V),
2525
Vector{PST}(p),
2626
)
2727
end
28-
#BasicSemialgebraicSet{T, PT<:APL{T}}(V::AlgebraicSet{T, PT}, p::Vector{PT}) = BasicSemialgebraicSet{T, PT}(V, p)
28+
#BasicSemialgebraicSet{T, PT<:_APL{T}}(V::AlgebraicSet{T, PT}, p::Vector{PT}) = BasicSemialgebraicSet{T, PT}(V, p)
2929
function basic_semialgebraic_set(V, p)
3030
return BasicSemialgebraicSet(V, p)
3131
end
@@ -50,7 +50,7 @@ end
5050

5151
function MP.variables(
5252
S::BasicSemialgebraicSet{T,PT,FullSpace},
53-
) where {T,PT<:APL{T}}
53+
) where {T,PT<:_APL{T}}
5454
return MP.variables(S.p)
5555
end
5656
function MP.variables(S::BasicSemialgebraicSet)

src/groebner.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ S(p, q) = \\frac{m}{\\mathrm{\\mathsc{LT}}(p)} \\cdot p - \\frac{m}{\\mathrm{\\
1010
```
1111
where ``m = \\mathrm{lcm}(\\mathrm{\\mathsc{LM}}(p), \\mathrm{\\mathsc{LM}}(q))``.
1212
"""
13-
function spolynomial(p::APL, q::APL)
13+
function spolynomial(p::_APL, q::_APL)
1414
m = lcm(leading_monomial(p), leading_monomial(q))
1515
ltp = leading_term(p)
1616
# `MA.operate` ensures that the returned value can be mutated without
@@ -23,7 +23,7 @@ function spolynomial(p::APL, q::APL)
2323
return MA.operate!!(-, ad, bd)
2424
end
2525

26-
function reduce_basis!(F::AbstractVector{<:APL}; kwargs...)
26+
function reduce_basis!(F::AbstractVector{<:_APL}; kwargs...)
2727
changed = true
2828
while changed
2929
changed = false
@@ -138,7 +138,7 @@ promote_for(::Type{T}, ::Type{Buchberger}) where {T} = promote_for_division(T)
138138
# Ideals, Varieties, and Algorithms
139139
# Cox, Little and O'Shea, Fourth edition
140140
function gröbner_basis!(
141-
F::AbstractVector{<:APL},
141+
F::AbstractVector{<:_APL},
142142
algo = default_gröbner_basis_algorithm(F),
143143
)
144144
algo.pre!(F)
@@ -170,7 +170,7 @@ function gröbner_basis!(
170170
map!(monic, F, F)
171171
return F
172172
end
173-
function gröbner_basis(F::Vector{<:APL}, args...)
173+
function gröbner_basis(F::Vector{<:_APL}, args...)
174174
T = Base.promote_op(rem, eltype(F), typeof(F))
175175
return gröbner_basis!(copyto!(similar(F, T), F), args...)
176176
end

src/ideal.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,36 @@ function ideal(p::FullSpace, _ = default_gröbner_basis_algorithm(p))
88
end
99
Base.rem(p::AbstractPolynomialLike, ::EmptyPolynomialIdeal) = p
1010

11-
mutable struct PolynomialIdeal{T,PT<:APL{T},A<:AbstractGröbnerBasisAlgorithm} <:
12-
AbstractPolynomialIdeal
11+
mutable struct PolynomialIdeal{
12+
T,
13+
PT<:_APL{T},
14+
A<:AbstractGröbnerBasisAlgorithm,
15+
} <: AbstractPolynomialIdeal
1316
p::Vector{PT}
1417
gröbner_basis::Bool
1518
algo::A
1619
end
1720
function PolynomialIdeal{T,PT}(
1821
p::Vector{PT},
1922
algo::A,
20-
) where {T,PT<:APL{T},A<:AbstractGröbnerBasisAlgorithm}
23+
) where {T,PT<:_APL{T},A<:AbstractGröbnerBasisAlgorithm}
2124
return PolynomialIdeal{T,PT,A}(p, false, algo)
2225
end
23-
function PolynomialIdeal(p::Vector{PT}, algo) where {T,PT<:APL{T}}
26+
function PolynomialIdeal(p::Vector{PT}, algo) where {T,PT<:_APL{T}}
2427
S = promote_for(T, typeof(algo))
2528
return PolynomialIdeal{S,polynomial_type(PT, S)}(
2629
AbstractVector{polynomial_type(PT, S)}(p),
2730
algo,
2831
)
2932
end
30-
function PolynomialIdeal{T,PT}() where {T,PT<:APL{T}}
33+
function PolynomialIdeal{T,PT}() where {T,PT<:_APL{T}}
3134
return PolynomialIdeal(PT[], default_gröbner_basis_algorithm(PT))
3235
end
3336

3437
function Base.convert(
3538
::Type{PolynomialIdeal{T,PT,A}},
3639
I::PolynomialIdeal{T,PT,A},
37-
) where {T,PT<:APL{T},A<:AbstractGröbnerBasisAlgorithm}
40+
) where {T,PT<:_APL{T},A<:AbstractGröbnerBasisAlgorithm}
3841
return I
3942
end
4043
function Base.convert(

src/solve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function default_multiplication_matrices_solver(::Type{T}) where {T}
165165
end
166166
function default_multiplication_matrices_solver(
167167
::AbstractVector{PT},
168-
) where {T,PT<:APL{T}}
168+
) where {T,PT<:_APL{T}}
169169
return default_multiplication_matrices_solver(T)
170170
end
171171

src/variety.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ function default_gröbner_basis_algorithm(p, lib::DefaultAlgebraicSetLibrary)
1010
end
1111

1212
function default_algebraic_set_library(
13-
::Vector{<:APL},
13+
::Vector{<:_APL},
1414
solver::AbstractAlgebraicSolver,
1515
)
1616
return DefaultAlgebraicSetLibrary(solver)
1717
end
18-
function default_algebraic_set_library(p::Vector{<:APL}, solveroralgo...)
18+
function default_algebraic_set_library(p::Vector{<:_APL}, solveroralgo...)
1919
return default_algebraic_set_library(
2020
p,
2121
default_algebraic_solver(p, solveroralgo...),
2222
)
2323
end
2424

25-
mutable struct AlgebraicSet{T,PT<:APL{T},A,S<:AbstractAlgebraicSolver,U} <:
25+
mutable struct AlgebraicSet{T,PT<:_APL{T},A,S<:AbstractAlgebraicSolver,U} <:
2626
AbstractAlgebraicSet
2727
I::PolynomialIdeal{T,PT,A}
2828
projective::Bool
@@ -56,7 +56,7 @@ end
5656
function Base.convert(
5757
::Type{AlgebraicSet{T,PT,A,S,U}},
5858
set::AlgebraicSet{T,PT,A,S,U},
59-
) where {T,PT<:APL{T},A,S<:AbstractAlgebraicSolver,U}
59+
) where {T,PT<:_APL{T},A,S<:AbstractAlgebraicSolver,U}
6060
return set
6161
end
6262
function Base.convert(

test/variety.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct DummyAlgo <: SemialgebraicSets.AbstractGröbnerBasisAlgorithm end
88
SemialgebraicSets.default_algebraic_solver(::Any, ::DummyAlgo) = DummySolver()
99
SemialgebraicSets.promote_for(::Type, ::Type{DummyAlgo}) = Int
1010
function SemialgebraicSets.gröbner_basis!(
11-
::AbstractVector{<:MP.APL},
11+
::AbstractVector{<:MP.AbstractPolynomialLike},
1212
::DummyAlgo,
1313
)
1414
return error("Dummy algo")

0 commit comments

Comments
 (0)