Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump MP to v0.4 #23

Merged
merged 4 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name = "SemialgebraicSets"
uuid = "8e049039-38e8-557d-ae3a-bc521ccf6204"
repo = "https://github.com/JuliaAlgebra/SemialgebraicSets.jl.git"
version = "0.2.3"
version = "0.2.4"

[deps]
DynamicPolynomials = "7c1d4256-1411-5781-91ec-d7bc3513ac07"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MultivariatePolynomials = "102ac46a-7ee4-5c85-9060-abc95bfdeaa3"
MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
TypedPolynomials = "afbbf031-7a57-5f58-a1b9-b774a0fad08d"

[compat]
MultivariatePolynomials = "0.3"
MultivariatePolynomials = "0.4.2"
julia = "1"

[extras]
DynamicPolynomials = "7c1d4256-1411-5781-91ec-d7bc3513ac07"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TypedPolynomials = "afbbf031-7a57-5f58-a1b9-b774a0fad08d"

[targets]
test = ["Test", "DynamicPolynomials"]
test = ["Test", "DynamicPolynomials", "TypedPolynomials"]
3 changes: 3 additions & 0 deletions src/SemialgebraicSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ module SemialgebraicSets

using Random

import MutableArithmetics
const MA = MutableArithmetics

using MultivariatePolynomials
const MP = MultivariatePolynomials

Expand Down
8 changes: 4 additions & 4 deletions src/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ end
function BasicSemialgebraicSet(V::AlgebraicSet{T, PT, A, S}, p::Vector{PT}) where {T, PT<:APL{T}, A, S<:AbstractAlgebraicSolver}
BasicSemialgebraicSet{T, PT, typeof(V)}(V, p)
end
function BasicSemialgebraicSet(V::AlgebraicSet{T, PT, A, ST}, p::Vector{PS}) where {T, PT<:APL{T}, S, PS<:APL{S}, A, ST<:AbstractAlgebraicSolver}
U = promote_type(T, S)
PU = promote_type(PT, PS)
BasicSemialgebraicSet(convert(AlgebraicSet{U, PU, A, ST}, V), Vector{PU}(p))
function BasicSemialgebraicSet(V::AlgebraicSet{T, PT, A, SO, U}, p::Vector{PS}) where {T, PT<:APL{T}, S, PS<:APL{S}, A, SO<:AbstractAlgebraicSolver, U}
ST = promote_type(T, S)
PST = promote_type(PT, PS)
BasicSemialgebraicSet(convert(AlgebraicSet{ST, PST, A, SO, U}, V), Vector{PST}(p))
end
#BasicSemialgebraicSet{T, PT<:APL{T}}(V::AlgebraicSet{T, PT}, p::Vector{PT}) = BasicSemialgebraicSet{T, PT}(V, p)
function basicsemialgebraicset(V, p)
Expand Down
10 changes: 9 additions & 1 deletion src/groebner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ where ``m = \\mathrm{lcm}(\\mathrm{\\mathsc{LM}}(p), \\mathrm{\\mathsc{LM}}(q))`
"""
function spolynomial(p::APL, q::APL)
m = lcm(leadingmonomial(p), leadingmonomial(q))
MultivariatePolynomials._div(m, leadingterm(p)) * p - MultivariatePolynomials._div(m, leadingterm(q)) * q
ltp = leadingterm(p)
# `MA.operate` ensures that the returned value can be mutated without
# affecting either `a` or `p`.
a = MA.operate(*, MP._div(m, monomial(ltp)), p)
ad = MA.operate!!(/, a, MP.coefficient(ltp))
ltq = leadingterm(q)
b = MA.operate(*, MP._div(m, monomial(ltq)), q)
bd = MA.operate!!(/, b, MP.coefficient(ltq))
return MA.operate!!(-, ad, bd)
end

function reducebasis!(F::AbstractVector{<:APL}; kwargs...)
Expand Down