Skip to content

Commit

Permalink
[FTheoryTools] Serialization sets cox rings of base and ambient space…
Browse files Browse the repository at this point in the history
… correctly
  • Loading branch information
HereAround committed Aug 22, 2024
1 parent 61bf7dc commit fafe0b4
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function hypersurface_model(base::NormalToricVariety, fiber_ambient_space::Norma
@req length(ds) == 1 "Inconsistency in determining the degree of the hypersurface equation"
@req ds[1] == divisor_class(anticanonical_divisor_class(ambient_space)).coeff "Degree of hypersurface equation differs from anticanonical bundle"
explicit_model_sections = Dict{String, MPolyRingElem}()
gens_S = gens(cox_ring(ambient_space))
gens_S = gens(cox_ring(base))
for k in 1:length(gens_S)
explicit_model_sections[string(gens_S[k])] = gens_S[k]
end
Expand Down
21 changes: 21 additions & 0 deletions experimental/FTheoryTools/src/Serialization/hypersurface_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,30 @@ end

function load_object(s::DeserializerState, ::Type{<:HypersurfaceModel}, params::Tuple{NormalToricVariety, NormalToricVariety, NormalToricVariety, <:MPolyRing, <:MPolyRing})
base_space, ambient_space, fiber_ambient_space, R1, R2 = params

# Ensure that ambient space's Cox ring has correct variable names, i.e. those used in the defining equation
defining_equation = load_object(s, MPolyRingElem, R1, :hypersurface_equation)
S = cox_ring(ambient_space)
S.R.S = symbols(parent(defining_equation))
defining_equation = Oscar.eval_poly(string(defining_equation), S)

# Read out defining equation parametrization
defining_equation_parametrization = load_object(s, MPolyRingElem, R2, :hypersurface_equation_parametrization)

# Read in explicit model sections and adjust the cox ring of the base space accordingly
S = cox_ring(base_space)
explicit_model_sections = haskey(s, :explicit_model_sections) ? load_typed_object(s, :explicit_model_sections) : Dict{String, MPolyRingElem}()
if !isempty(explicit_model_sections)
# @Antony: The following line should be executed ALWAYS, irrespective of having a non-empty dict explicit_model sections.
# Proposal: We remember a list of strings and add this to the serialzation, alongside base_space, ambient_space, fiber_ambient_space, etc.
# Consequence: In particular, the QSM .mrdi files need updating. Please advice.
S.R.S = symbols(parent(first(values(explicit_model_sections))))
for (key, value) in explicit_model_sections
explicit_model_sections[key] = Oscar.eval_poly(string(value), S)
end
end

# Create the model, set remaining attributes and return to user
defining_classes = haskey(s, :defining_classes) ? load_typed_object(s, :defining_classes) : Dict{String, ToricDivisorClass}()
model = HypersurfaceModel(explicit_model_sections, defining_equation_parametrization, defining_equation, base_space, ambient_space, fiber_ambient_space)
model.defining_classes = defining_classes
Expand Down
19 changes: 19 additions & 0 deletions experimental/FTheoryTools/src/Serialization/tate_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,27 @@ end

function load_object(s::DeserializerState, ::Type{<: GlobalTateModel}, params::Tuple{NormalToricVariety, NormalToricVariety, MPolyDecRing})
base_space, ambient_space, tp_ring = params

# Ensure that ambient space's Cox ring has correct variable names, i.e. those used in the defining equation
pt = load_object(s, MPolyDecRingElem, tp_ring, :tate_polynomial)
S = cox_ring(ambient_space)
S.R.S = symbols(parent(pt))
pt = Oscar.eval_poly(string(pt), S)

# Read in explicit model sections
S = cox_ring(base_space)
explicit_model_sections = haskey(s, :explicit_model_sections) ? load_typed_object(s, :explicit_model_sections) : Dict{String, MPolyRingElem}()
if !isempty(explicit_model_sections)
# @Antony: The following line should be executed ALWAYS, irrespective of having a non-empty dict explicit_model sections.
# Proposal: We remember a list of strings and add this to the serialzation, alongside base_space, ambient_space, fiber_ambient_space, etc.
# Consequence: In particular, the QSM .mrdi files need updating. Please advice.
S.R.S = symbols(parent(first(values(explicit_model_sections))))
for (key, value) in explicit_model_sections
explicit_model_sections[key] = Oscar.eval_poly(string(value), S)
end
end

# Create the model, set remaining attributes and return to user
defining_section_parametrization = haskey(s, :defining_section_parametrization) ? load_typed_object(s, :defining_section_parametrization) : Dict{String, MPolyRingElem}()
defining_classes = haskey(s, :defining_classes) ? load_typed_object(s, :defining_classes) : Dict{String, ToricDivisorClass}()
model = GlobalTateModel(explicit_model_sections, defining_section_parametrization, pt, base_space, ambient_space)
Expand Down
19 changes: 19 additions & 0 deletions experimental/FTheoryTools/src/Serialization/weierstrass_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,27 @@ end

function load_object(s::DeserializerState, ::Type{<: WeierstrassModel}, params::Tuple{NormalToricVariety, NormalToricVariety, MPolyDecRing})
base_space, ambient_space, wp_ring = params

# Ensure that ambient space's Cox ring has correct variable names, i.e. those used in the defining equation
pw = load_object(s, MPolyDecRingElem, wp_ring, :weierstrass_polynomial)
S = cox_ring(ambient_space)
S.R.S = symbols(parent(pw))
pw = Oscar.eval_poly(string(pw), S)

# Read in explicit model sections
S = cox_ring(base_space)
explicit_model_sections = haskey(s, :explicit_model_sections) ? load_typed_object(s, :explicit_model_sections) : Dict{String, MPolyRingElem}()
if !isempty(explicit_model_sections)
# @Antony: The following line should be executed ALWAYS, irrespective of having a non-empty dict explicit_model sections.
# Proposal: We remember a list of strings and add this to the serialzation, alongside base_space, ambient_space, fiber_ambient_space, etc.
# Consequence: In particular, the QSM .mrdi files need updating. Please advice.
S.R.S = symbols(parent(first(values(explicit_model_sections))))
for (key, value) in explicit_model_sections
explicit_model_sections[key] = Oscar.eval_poly(string(value), S)
end
end

# Create the model, set remaining attributes and return to user
defining_section_parametrization = haskey(s, :defining_section_parametrization) ? load_typed_object(s, :defining_section_parametrization) : Dict{String, MPolyRingElem}()
defining_classes = haskey(s, :defining_classes) ? load_typed_object(s, :defining_classes) : Dict{String, ToricDivisorClass}()
model = WeierstrassModel(explicit_model_sections, defining_section_parametrization, pw, base_space, ambient_space)
Expand Down

0 comments on commit fafe0b4

Please sign in to comment.