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

Speed up polynomial mappings #4124

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6fd471a
Attempt to speed up mapping of polynomials.
HechtiDerLachs Sep 19, 2024
70279f9
Some more steps towards making stuff faster.
HechtiDerLachs Sep 19, 2024
4304881
Try to make general evaluation faster.
HechtiDerLachs Sep 24, 2024
a96cf36
Clean up general evaluation.
HechtiDerLachs Sep 25, 2024
b6a3c40
Fix tests.
HechtiDerLachs Sep 30, 2024
d1f90e3
Widen type signature so that more rings benefit from variable-map.
HechtiDerLachs Sep 30, 2024
f98f198
Fix call.
HechtiDerLachs Sep 30, 2024
570e769
Implement extension for localizations and quotients.
HechtiDerLachs Sep 30, 2024
2d83dd6
Switch default for _allunique.
HechtiDerLachs Sep 30, 2024
9a59613
Fix tests.
HechtiDerLachs Sep 30, 2024
4e5b8e7
Remove superfluous if-clause and add some comments.
HechtiDerLachs Sep 30, 2024
f005ce1
Fix doctests in Algebraic statistics.
HechtiDerLachs Sep 30, 2024
0c65e56
Fix doctests in FTheoryTools.
HechtiDerLachs Sep 30, 2024
8944bb2
Fix doctests in AffineSchemes.
HechtiDerLachs Sep 30, 2024
90dc095
Revert "Fix doctests in FTheoryTools."
HechtiDerLachs Sep 30, 2024
5d61dda
Revert "Fix doctests in Algebraic statistics."
HechtiDerLachs Sep 30, 2024
7ad7f39
Remove duplicated code.
HechtiDerLachs Sep 30, 2024
4d17d35
Revert to a single internal constructor.
HechtiDerLachs Sep 30, 2024
f7289e8
Fix internal method.
HechtiDerLachs Sep 30, 2024
9092a8a
Remove some more code duplication.
HechtiDerLachs Sep 30, 2024
733b8f1
Switch to the AA methods.
HechtiDerLachs Oct 1, 2024
1892dab
Update src/Rings/MPolyMap/MPolyAnyMap.jl
simonbrandhorst Oct 1, 2024
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
6 changes: 5 additions & 1 deletion experimental/AlgebraicStatistics/src/CI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ julia> ci_statements(["A", "B", "X", "Y"])
[B _||_ Y | {A, X}]
[X _||_ Y | {}]
[X _||_ Y | A]
[X _||_ Y | B]
[X _||_ Y | {A, B}]
[A _||_ X | {}]
[A _||_ X | B]
[A _||_ X | Y]
[A _||_ X | {B, Y}]
[B _||_ X | {}]
[B _||_ X | A]
Expand Down
6 changes: 5 additions & 1 deletion experimental/AlgebraicStatistics/src/Markov.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ julia> ci_statements(R)
[B _||_ Y | {A, X}]
[X _||_ Y | {}]
[X _||_ Y | A]
[X _||_ Y | B]
[X _||_ Y | {A, B}]
[A _||_ X | {}]
[A _||_ X | B]
[A _||_ X | Y]
[A _||_ X | {B, Y}]
[B _||_ X | {}]
[B _||_ X | A]
Expand Down
112 changes: 98 additions & 14 deletions experimental/AlgebraicStatistics/src/PhylogeneticParametrization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,64 @@ Dict{Tuple{Vararg{Int64}}, QQMPolyRingElem} with 64 entries:
(1, 2, 1) => 1//4*a[1]*a[3]*b[2] + 1//4*a[2]*b[1]*b[3] + 1//2*b[1]*b[2]*b[3]
(3, 1, 1) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*a[3]*b[1] + 1//2*b[1]*b[2]*b[3]
(4, 4, 2) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(1, 2, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2]
(1, 2, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[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1//4*b[1]*b[2]*b[3]
(1, 4, 2) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(2, 1, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(2, 2, 4) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(4, 3, 4) => 1//4*a[1]*a[3]*b[2] + 1//4*a[2]*b[1]*b[3] + 1//2*b[1]*b[2]*b[3]
(2, 2, 1) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(4, 4, 4) => 1//4*a[1]*a[2]*a[3] + 3//4*b[1]*b[2]*b[3]
(4, 3, 1) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2]
(4, 3, 1) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(3, 3, 2) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(4, 1, 2) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(4, 4, 1) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(2, 2, 3) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(3, 4, 2) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(4, 3, 3) => 1//4*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*b[2]*b[3] + 1//4*a[2]*a[3]*b[1] + 1//2*b[1]*b[2]*b[3]
(3, 3, 1) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(4, 1, 1) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*a[3]*b[1] + 1//2*b[1]*b[2]*b[3]
(1, 2, 2) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*a[3]*b[1] + 1//2*b[1]*b[2]*b[3]
(3, 1, 2) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(3, 4, 1) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(3, 3, 3) => 1//4*a[1]*a[2]*a[3] + 3//4*b[1]*b[2]*b[3]
(4, 1, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(4, 2, 4) => 1//4*a[1]*a[3]*b[2] + 1//4*a[2]*b[1]*b[3] + 1//2*b[1]*b[2]*b[3]
(3, 4, 3) => 1//4*a[1]*a[3]*b[2] + 1//4*a[2]*b[1]*b[3] + 1//2*b[1]*b[2]*b[3]
(4, 2, 1) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(3, 2, 2) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*a[3]*b[1] + 1//2*b[1]*b[2]*b[3]
(2, 3, 4) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(4, 2, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(2, 3, 1) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(2, 4, 4) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*a[3]*b[1] + 1//2*b[1]*b[2]*b[3]
(1, 1, 4) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(2, 1, 2) => 1//4*a[1]*a[3]*b[2] + 1//4*a[2]*b[1]*b[3] + 1//2*b[1]*b[2]*b[3]
(2, 4, 1) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(1, 1, 1) => 1//4*a[1]*a[2]*a[3] + 3//4*b[1]*b[2]*b[3]
(2, 3, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*a[3]*b[1] + 1//2*b[1]*b[2]*b[3]
(2, 4, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(1, 1, 3) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]
(1, 2, 4) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
⋮ => ⋮
```
"""
Expand Down Expand Up @@ -155,6 +197,48 @@ Dict{Tuple{Vararg{Int64}}, QQMPolyRingElem} with 64 entries:
(4, 4, 4) => 0
(4, 3, 1) => 0
(3, 3, 2) => 0
(4, 1, 2) => 0
(4, 4, 1) => x[3, 1]*x[1, 2]*x[2, 2]
(2, 2, 3) => 0
(3, 4, 2) => x[1, 2]*x[2, 2]*x[3, 2]
(4, 3, 3) => 0
(4, 4, 3) => 0
(4, 2, 2) => 0
(1, 3, 4) => 0
(2, 3, 2) => 0
(1, 4, 4) => x[1, 1]*x[2, 2]*x[3, 2]
(1, 3, 1) => 0
(2, 4, 2) => 0
(1, 1, 2) => 0
(1, 4, 1) => 0
(1, 3, 3) => x[1, 1]*x[2, 2]*x[3, 2]
(3, 3, 4) => 0
(1, 4, 3) => 0
(4, 1, 4) => x[2, 1]*x[1, 2]*x[3, 2]
(3, 4, 4) => 0
(3, 3, 1) => x[3, 1]*x[1, 2]*x[2, 2]
(4, 1, 1) => 0
(1, 2, 2) => x[1, 1]*x[2, 2]*x[3, 2]
(3, 1, 2) => 0
(3, 4, 1) => 0
(3, 3, 3) => 0
(4, 1, 3) => 0
(4, 2, 4) => 0
(3, 4, 3) => 0
(4, 2, 1) => 0
(3, 2, 2) => 0
(2, 3, 4) => x[1, 2]*x[2, 2]*x[3, 2]
(4, 2, 3) => x[1, 2]*x[2, 2]*x[3, 2]
(2, 3, 1) => 0
(2, 4, 4) => 0
(1, 1, 4) => 0
(2, 1, 2) => x[2, 1]*x[1, 2]*x[3, 2]
(2, 4, 1) => 0
(1, 1, 1) => x[1, 1]*x[2, 1]*x[3, 1]
(2, 3, 3) => 0
(2, 4, 3) => x[1, 2]*x[2, 2]*x[3, 2]
(1, 1, 3) => 0
(1, 2, 4) => 0
⋮ => ⋮
```
"""
Expand Down Expand Up @@ -192,16 +276,16 @@ Dict{Tuple{Vararg{Int64}}, QQMPolyRingElem} with 5 entries:
(1, 2, 1) => 1//4*a[1]*a[3]*b[2] + 1//4*a[2]*b[1]*b[3] + 1//2*b[1]*b[2]*b[3]
(1, 1, 1) => 1//4*a[1]*a[2]*a[3] + 3//4*b[1]*b[2]*b[3]
(1, 2, 2) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*a[3]*b[1] + 1//2*b[1]*b[2]*b[3]
(1, 2, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2]
(1, 2, 3) => 1//4*a[1]*b[2]*b[3] + 1//4*a[2]*b[1]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//4*b[1]*b[2]*b[3]
(1, 1, 2) => 1//4*a[1]*a[2]*b[3] + 1//4*a[3]*b[1]*b[2] + 1//2*b[1]*b[2]*b[3]

julia> p_equivclasses.classes
Dict{Tuple{Vararg{Int64}}, Vector{Tuple{Vararg{Int64}}}} with 5 entries:
(1, 2, 1) => [(1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 2), (2, 3, 2), (2, 4, 2
(1, 2, 1) => [(1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 2), (2, 3, 2), (2, 4, 2), (3, 1, 3), (3, 2, 3), (3, 4, 3), (4, 1, 4), (4, 2, 4), (4, 3, 4)]
(1, 1, 1) => [(1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4)]
(1, 2, 2) => [(1, 2, 2), (1, 3, 3), (1, 4, 4), (2, 1, 1), (2, 3, 3), (2, 4, 4
(1, 2, 3) => [(1, 2, 3), (1, 2, 4), (1, 3, 2), (1, 3, 4), (1, 4, 2), (1, 4, 3…
(1, 1, 2) => [(1, 1, 2), (1, 1, 3), (1, 1, 4), (2, 2, 1), (2, 2, 3), (2, 2, 4
(1, 2, 2) => [(1, 2, 2), (1, 3, 3), (1, 4, 4), (2, 1, 1), (2, 3, 3), (2, 4, 4), (3, 1, 1), (3, 2, 2), (3, 4, 4), (4, 1, 1), (4, 2, 2), (4, 3, 3)]
(1, 2, 3) => [(1, 2, 3), (1, 2, 4), (1, 3, 2), (1, 3, 4), (1, 4, 2), (1, 4, 3), (2, 1, 3), (2, 1, 4), (2, 3, 1), (2, 3, 4) … (3, 2, 1), (3, 2, 4), (3, 4, 1), (3, 4, 2), (4, 1, 2), (4, 1, 3), (4, 2, 1), (4,
(1, 1, 2) => [(1, 1, 2), (1, 1, 3), (1, 1, 4), (2, 2, 1), (2, 2, 3), (2, 2, 4), (3, 3, 1), (3, 3, 2), (3, 3, 4), (4, 4, 1), (4, 4, 2), (4, 4, 3)]

julia> q_equivclasses = compute_equivalent_classes(q);

Expand Down Expand Up @@ -251,7 +335,7 @@ Dict{Tuple{Int64, Int64, Int64}, QQMPolyRingElem} with 5 entries:
(1, 2, 1) => 3*a[1]*a[3]*b[2] + 3*a[2]*b[1]*b[3] + 6*b[1]*b[2]*b[3]
(1, 1, 1) => a[1]*a[2]*a[3] + 3*b[1]*b[2]*b[3]
(1, 2, 2) => 3*a[1]*b[2]*b[3] + 3*a[2]*a[3]*b[1] + 6*b[1]*b[2]*b[3]
(1, 2, 3) => 6*a[1]*b[2]*b[3] + 6*a[2]*b[1]*b[3] + 6*a[3]*b[1]*b[2] + 6*b[1]*
(1, 2, 3) => 6*a[1]*b[2]*b[3] + 6*a[2]*b[1]*b[3] + 6*a[3]*b[1]*b[2] + 6*b[1]*b[2]*b[3]
(1, 1, 2) => 3*a[1]*a[2]*b[3] + 3*a[3]*b[1]*b[2] + 6*b[1]*b[2]*b[3]
```
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,8 @@ julia> components_of_dual_graph(qsm_model)
"C7"
"C8"
"C9"
"C13"
"C14"
"C16"
"C17"
"C21"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,7 @@ function Base.show(io::IO, ::MIME"text/plain", a::AffineSchemeOpenSubschemeRingE
end
end

# overwrite a method for mapping of rings which would throw otherwise
function _allunique(lst::Vector{T}) where {T<:MPolyQuoRingElem{<:MPolyRingElem{<:AffineSchemeOpenSubschemeRingElem}}}
return false
end
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x1 -> x1
HechtiDerLachs marked this conversation as resolved.
Show resolved Hide resolved
x2 -> x2
x3 -> x3

Expand Down Expand Up @@ -95,7 +95,7 @@ Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x1 -> x1
x2 -> x2
x3 -> x3

Expand Down Expand Up @@ -143,7 +143,7 @@ Ring homomorphism
from multivariate polynomial ring in 3 variables over QQ
to quotient of multivariate polynomial ring by ideal (x1)
defined by
x1 -> 0
x1 -> x1
x2 -> x2
x3 -> x3
```
Expand Down Expand Up @@ -254,7 +254,7 @@ Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x1 -> x1
x2 -> x2
x3 -> x3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x1 -> x1
x2 -> x2
x3 -> x3

Expand Down Expand Up @@ -181,7 +181,7 @@ Affine scheme morphism
from [x1, x2, x3] scheme(x1)
to [x1, x2, x3] affine 3-space over QQ
given by the pullback function
x1 -> 0
x1 -> x1
x2 -> x2
x3 -> x3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Affine scheme morphism
from [x, y] scheme(x)
to [x, y] affine 2-space over QQ
given by the pullback function
x -> 0
x -> x
y -> y

julia> inc == inclusion_morphism(Y, X)
Expand Down
35 changes: 28 additions & 7 deletions src/Rings/MPolyMap/MPolyAnyMap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,38 @@ const _DomainTypes = Union{MPolyRing, MPolyQuoRing}
coeff_map::U
img_gens::Vector{V}
temp_ring # temporary ring used when evaluating maps
variable_indices::Vector{Int} # a table where the i-th entry contains the
# index of the variable where it is mapped to
# in case the mapping takes such a particularly
# simple form.

function MPolyAnyMap{D, C, U, V}(domain::D,
codomain::C,
coeff_map::U,
img_gens::Vector{V}) where {D, C, U, V}
@assert V === elem_type(C)
for g in img_gens
@assert parent(g) === codomain "elements does not have the correct parent"
end
codomain::C,
coeff_map::U,
img_gens::Vector{V}) where {D, C, U, V}
@assert V === elem_type(C)
for g in img_gens
@assert parent(g) === codomain "elements does not have the correct parent"
end
return new{D, C, U, V}(domain, codomain, coeff_map, img_gens)
end
function MPolyAnyMap{D, C, U, V}(domain::D,
codomain::C,
coeff_map::U,
img_gens::Vector{V};
check_for_mapping_of_vars::Bool=true
) where {D <: Union{<:MPolyRing, <:MPolyQuoRing},
C, U, V}
@assert V === elem_type(C)
for g in img_gens
@assert parent(g) === codomain "elements does not have the correct parent"
end
result = new{D, C, U, V}(domain, codomain, coeff_map, img_gens)
if check_for_mapping_of_vars && all(_is_gen, img_gens) && _allunique(img_gens)
result.variable_indices = [findfirst(==(x), gens(codomain)) for x in img_gens]
simonbrandhorst marked this conversation as resolved.
Show resolved Hide resolved
simonbrandhorst marked this conversation as resolved.
Show resolved Hide resolved
end
return result
end
end

function MPolyAnyMap(d::D, c::C, cm::U, ig::Vector{V}) where {D, C, U, V}
Expand Down
Loading
Loading