diff --git a/.github/workflows/Docstrings.yml b/.github/workflows/Docstrings.yml new file mode 100644 index 000000000000..c3ae6a2f5780 --- /dev/null +++ b/.github/workflows/Docstrings.yml @@ -0,0 +1,29 @@ +name: docstring test + +on: + push: + branches: + - master + - 'release-*' + pull_request: + workflow_dispatch: + +concurrency: + # group by workflow and ref; the last slightly strange component ensures that for pull + # requests, we limit to 1 concurrent job, but for the master branch we don't + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }} + # Cancel intermediate builds, but only if it is a pull request build. + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + check-docstrings: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + - uses: julia-actions/cache@v2 + - name: Build package + uses: julia-actions/julia-buildpkg@v1 + - name: 'Check issues in docstrings' + run: | + julia --project=. -e 'using Oscar; include("etc/check_docstrings.jl")' diff --git a/LICENSE.md b/LICENSE.md index d5ab55d1895a..2faf769ff70e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,11 @@ The Oscar.jl package is licensed under the GNU Public License, Version 3.0+: -> Copyright (c) 2019 The OSCAR Development Team. +> Copyright (c) 2019-2024 The OSCAR Development Team +> +> See for a list of OSCAR +> Development Team members. Note that this list may occasionally be slightly +> outdated. Additional contributors may be found in the `git log` of the main +> OSCAR repository and other related repositories. > This program is free software: you can redistribute it and/or modify > it under the terms of the GNU General Public License as published by > the Free Software Foundation, either version 3 of the License, or diff --git a/Project.toml b/Project.toml index a8f6d8da0485..ff89d27f55f9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Oscar" uuid = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13" authors = ["The OSCAR Team "] -version = "1.2.0" +version = "1.2.1" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" diff --git a/README.md b/README.md index 5dba2c6a242c..912401b4c4c6 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ julia> using Oscar / _ \ / ___| / ___| / \ | _ \ | Combining ANTIC, GAP, Polymake, Singular | | | |\___ \| | / _ \ | |_) | | Type "?Oscar" for more information | |_| | ___) | |___ / ___ \| _ < | Manual: https://docs.oscar-system.org - \___/ |____/ \____/_/ \_\_| \_\ | Version 1.2.0 + \___/ |____/ \____/_/ \_\_| \_\ | Version 1.2.1 + julia> k, a = quadratic_field(-5) (Imaginary quadratic field defined by x^2 + 5, sqrt(-5)) @@ -113,7 +114,7 @@ pm::Array > If you have used OSCAR in the preparation of a paper please cite it as described below: [OSCAR] - OSCAR -- Open Source Computer Algebra Research system, Version 1.2.0, + OSCAR -- Open Source Computer Algebra Research system, Version 1.2.1, The OSCAR Team, 2024. (https://www.oscar-system.org) [OSCAR-book] Wolfram Decker, Christian Eder, Claus Fieker, Max Horn, Michael Joswig, eds. @@ -126,7 +127,7 @@ If you are using BibTeX, you can use the following BibTeX entries: key = {OSCAR}, organization = {The OSCAR Team}, title = {OSCAR -- Open Source Computer Algebra Research system, - Version 1.2.0}, + Version 1.2.1}, year = {2024}, url = {https://www.oscar-system.org}, } diff --git a/docs/Project.toml b/docs/Project.toml index 07d7ae149a80..6dad0075f817 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,7 +1,9 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" [compat] Documenter = "1.1" DocumenterCitations = "~1.3.4" +JSON = "0.21.4" diff --git a/docs/make_work.jl b/docs/make_work.jl index b3a0aec16741..91efab27a67c 100644 --- a/docs/make_work.jl +++ b/docs/make_work.jl @@ -4,7 +4,7 @@ # module BuildDoc -using Documenter, DocumenterCitations +using Documenter, DocumenterCitations, JSON include("documenter_helpers.jl") include("citation_style.jl") @@ -210,6 +210,56 @@ function doit( dstbase = normpath(Oscar.oscardir, "docs", "src", string(nameof(pkg))) rm(dstbase; recursive=true, force=true) end + + # postprocessing, for the search index + docspath = normpath(joinpath(Oscar.oscardir, "docs")) + @info "Patching search index." + # extract valid json from search_index.js + run(pipeline(`sed -n '2p;3q' $(joinpath(docspath, "build", "search_index.js"))`, stdout=(joinpath(docspath, "build", "search_index.json")))) # imperfect file, but JSON parses it + + # extract paths from doc.main + filelist=String[] + docmain = include(joinpath(docspath, "doc.main")) + while !isempty(docmain) + n = pop!(docmain) + if n isa Pair + push!(docmain, last(n)) + elseif n isa String + push!(filelist, n) + elseif n isa Array{String} + append!(filelist,n) + elseif n isa Array + append!(docmain,n) + else + error("err: $(typeof(n))") + end + end + suffix = local_build ? ".html" : "/" + filelist = replace.(filelist, r"\.md$"=>suffix) + + # read these files + iosearchindex = open(joinpath(docspath, "build", "search_index.json"), "r") + searchindex = JSON.parse(iosearchindex) + close(iosearchindex) + + newsearchindex = [] + + for item in searchindex + if split(item["location"], "#")[1] in filelist + push!(newsearchindex, item) + end + end + + + # combine this to valid javascript again, and overwrite input + ionewsearchindex = open(joinpath(docspath, "build", "search_index.js"), "w") + write(ionewsearchindex, """var documenterSearchIndex = {"docs":\n""") + JSON.print(ionewsearchindex, newsearchindex) + write(ionewsearchindex, "\n}") + close(ionewsearchindex) + + # clean up + rm(joinpath(docspath, "build", "search_index.json")) end end # module BuildDoc diff --git a/docs/oscar_references.bib b/docs/oscar_references.bib index c6e93053f394..f4d98cea61df 100644 --- a/docs/oscar_references.bib +++ b/docs/oscar_references.bib @@ -34,7 +34,7 @@ @Article{AG10 number = {1}, pages = {3--24}, year = {2010}, - eprint = {0810.1148} + doi = {10.1070/SM2010v201n01ABEH004063} } @InProceedings{AGK96, @@ -155,6 +155,7 @@ @InProceedings{BDLP19 booktitle = {MEGA 2019 - International Conference on Effective Methods in Algebraic Geometry}, address = {Madrid, Spain}, year = {2019}, + doi = {10.1016/j.jsc.2020.07.007}, archiveprefix = {HAL}, eprint = {hal-02912148} } @@ -193,13 +194,17 @@ @InProceedings{BES-E-D21 location = {Virtual Event, Russian Federation} } -@Misc{BES19, +@Article{BES23, author = {Backman, Spencer and Eur, Christopher and Simpson, Connor}, title = {Simplicial generation of Chow rings of matroids}, - year = {2019}, - eprint = {1905.07114}, - archiveprefix = {arXiv}, - primaryclass = {math.CO} + journal = {JEMS}, + fjournal = {Journal of the European Mathematical Society}, + volume = {26}, + number = {11}, + pages = {4491--4535}, + year = {2023}, + month = jun, + doi = {10.4171/jems/1350} } @Book{BGV03, @@ -236,13 +241,15 @@ @Article{BH23 doi = {10.1017/fms.2023.50} } -@Misc{BHMPW20, +@Article{BHMPW22, author = {Braden, Tom and Huh, June and Matherne, Jacob P. and Proudfoot, Nicholas and Wang, Botong}, title = {A semi-small decomposition of the Chow ring of a matroid}, - year = {2020}, - eprint = {2002.03341}, - archiveprefix = {arXiv}, - primaryclass = {math.AG} + journal = {Advances in Mathematics}, + volume = {409}, + pages = {108646}, + year = {2022}, + month = nov, + doi = {10.1016/j.aim.2022.108646} } @Book{BHPV-D-V04, @@ -254,6 +261,7 @@ @Book{BHPV-D-V04 publisher = {Berlin: Springer}, edition = {2nd enlarged ed.}, year = {2004}, + doi = {10.1007/978-3-642-57739-0}, fseries = {Ergebnisse der Mathematik und ihrer Grenzgebiete. 3. Folge}, language = {English}, zbmath = {2008523} @@ -364,7 +372,8 @@ @Book{Ben93 volume = {190}, address = {Cambridge}, publisher = {Cambridge University Press}, - year = {1993} + year = {1993}, + doi = {10.1017/CBO9780511565809} } @MastersThesis{Bhm99, @@ -409,14 +418,15 @@ @Article{Bis96 doi = {10.1112/S0025579300011773} } -@Book{Bur55, +@Book{Bur11, author = {Burnside, W.}, title = {Theory of groups of finite order}, mrnumber = {69818}, note = {2d ed}, publisher = {Dover Publications, Inc., New York}, pages = {xxiv+512}, - year = {1955} + year = {1911}, + doi = {10.1017/CBO9781139237253} } @Book{C-MLS20, @@ -633,6 +643,7 @@ @InCollection{DE02 publisher = {Berlin: Springer}, pages = {215--249}, year = {2002}, + doi = {10.1007/978-3-662-04851-1_9}, language = {English}, zbmath = {1693054} } @@ -742,7 +753,8 @@ @Article{DK17 fjournal = {Journal of Algebra}, volume = {472}, pages = {546--572}, - year = {2017} + year = {2017}, + doi = {10.1016/j.jalgebra.2016.10.042} } @Book{DL06, @@ -803,6 +815,7 @@ @Book{DSS09 volume = {39}, publisher = {Basel: Birkhäuser}, year = {2009}, + doi = {10.1007/978-3-7643-8905-5}, fseries = {Oberwolfach Seminars}, language = {English}, zbmath = {5303649} @@ -1001,6 +1014,7 @@ @InProceedings{FLINT publisher = {Springer-Verlag}, pages = {88--91}, year = {2010}, + doi = {10.1007/978-3-642-15582-6_18}, location = {Kobe, Japan}, numpages = {4} } @@ -1050,7 +1064,8 @@ @Book{Ful97 note = {With applications to representation theory and geometry}, publisher = {Cambridge University Press, Cambridge}, pages = {x+260}, - year = {1997} + year = {1997}, + doi = {10.1017/CBO9780511626241} } @Book{Ful98, @@ -1087,7 +1102,8 @@ @InProceedings{GHJ16 address = {Cham}, publisher = {Springer International Publishing}, pages = {403--410}, - year = {2016} + year = {2016}, + doi = {10.1007/978-3-319-42432-3_50} } @Article{GIR96, @@ -1133,7 +1149,8 @@ @InProceedings{GK14 booktitle = {Proceedings of the fifteenth ACM conference on Economics and computation}, publisher = {Association for Computing Machinery, New York}, pages = {259--276}, - year = {2014} + year = {2014}, + doi = {10.1145/2600057.2602883} } @Book{GLS07, @@ -1418,7 +1435,8 @@ @Article{JKS22 number = {4}, publisher = {SIAM}, pages = {711--739}, - year = {2022} + year = {2022}, + doi = {10.1137/21M1441286} } @Article{JLLT22, @@ -1522,7 +1540,8 @@ @Book{Jos21 volume = {219}, address = {Providence, RI}, publisher = {American Mathematical Society}, - year = {2021} + year = {2021}, + doi = {10.1090/gsm/219} } @Article{Jow11, @@ -1616,7 +1635,8 @@ @InCollection{KS99 volume = {173}, publisher = {Birkhäuser, Basel}, pages = {267--285}, - year = {1999} + year = {1999}, + doi = {10.1007/978-3-0348-8716-8_17} } @Article{Kah10, @@ -1692,6 +1712,7 @@ @Book{Kol13 note = {With a collaboration of Sándor Kovács}, publisher = {Cambridge University Press}, year = {2013}, + doi = {10.1017/CBO9781139547895}, location = {Cambridge} } @@ -1774,7 +1795,8 @@ @Book{Loo84 volume = {77}, publisher = {Cambridge University Press, Cambridge}, pages = {xi+200}, - year = {1984} + year = {1984}, + doi = {10.1017/CBO9780511662720} } @Misc{MNP24, @@ -1834,7 +1856,8 @@ @Book{MS15 volume = {161}, publisher = {Providence, RI: American Mathematical Society (AMS)}, pages = {xii + 363}, - year = {2015} + year = {2015}, + doi = {10.1090/gsm/161} } @Book{MS21, @@ -2012,7 +2035,8 @@ @Article{Pos09 number = {6}, publisher = {OUP}, pages = {1026--1106}, - year = {2009} + year = {2009}, + doi = {10.1093/imrn/rnn153} } @Article{Pos18, @@ -2048,13 +2072,14 @@ @Article{RR10 doi = {10.1063/1.3501135} } -@Article{RSS03, +@InBook{RSS03, author = {Rote, Günter and Santos, Francisco and Streinu, Ileana}, title = {Expansive motions and the polytope of pointed pseudo-triangulations}, - journal = {Discrete and Computational Geometry: The Goodman-Pollack Festschrift}, + booktitle = {Discrete and Computational Geometry}, publisher = {Springer}, pages = {699--736}, - year = {2003} + year = {2003}, + doi = {10.1007/978-3-642-55566-4_33} } @Article{Rin13, @@ -2078,6 +2103,7 @@ @Book{SS03 volume = {24}, publisher = {Oxford University Press}, year = {2003}, + doi = {10.1093/oso/9780198509424.001.0001}, fseries = {Oxford Lecture Series in Mathematics and its Applications} } @@ -2191,7 +2217,8 @@ @Article{Sta79 volume = {1}, number = {3}, pages = {475--511}, - year = {1979} + year = {1979}, + doi = {10.1090/S0273-0979-1979-14597-X} } @Misc{Stacks, diff --git a/docs/src/Groups/tom.md b/docs/src/Groups/tom.md index fb04e7274c40..05f64e78bfe2 100644 --- a/docs/src/Groups/tom.md +++ b/docs/src/Groups/tom.md @@ -6,7 +6,7 @@ DocTestSetup = Oscar.doctestsetup() # Tables of Marks The concept of a *Table of Marks* was introduced by W. Burnside in his book -Theory of Groups of Finite Order [Bur55](@cite). +Theory of Groups of Finite Order [Bur11](@cite). Therefore a table of marks is sometimes called a *Burnside matrix*. The table of marks of a finite group ``G`` is a matrix whose rows and columns are labelled by the conjugacy classes of subgroups of ``G`` and where for diff --git a/etc/check_docstrings.jl b/etc/check_docstrings.jl new file mode 100644 index 000000000000..72caa4d49495 --- /dev/null +++ b/etc/check_docstrings.jl @@ -0,0 +1,107 @@ +# this can be run from the command line with: +# > julia --project=. -e 'using Oscar; include("etc/check_docstrings.jl")' +# +# it is also possible to test more packages at once (as long as Main.X exists) +# > julia --project=. -e 'using Oscar; include("etc/check_docstrings.jl")' Nemo Singular Hecke Polymake GAP Oscar +# +# note: the @main function requires julia 1.11 or newer + + +using Markdown + +admonition_types = string.((:note, :info, :tip, :danger, :warning, :compat, :todo, :details)) + +# this might not catch all broken jldoctests but seems to work for now +function has_broken_doctest(md::Markdown.MD) + todo = copy(md.content) + while !isempty(todo) + elem = popfirst!(todo) + # nested + if elem isa Markdown.MD + append!(todo, elem.content) + else + # proper docstrings are in a Markdown.Code block + if elem isa Markdown.Paragraph + for block in elem.content + # unterminated jldoctests seem to end up inside some string in a Paragraph block + if contains(string(block),"```jldoctest") + return "Unterminated jldoctest: $(string(block))" + end + end + elseif elem isa Markdown.Admonition + if !(elem.category in admonition_types) + return "Unknown admonition category: $(string(elem.category))" + end + end + end + end + return nothing +end + +function find_docstr_src(docs) + locs = [] + res = docs.meta[:results] + for i in 1:length(docs.content) + msg = has_broken_doctest(docs.content[i]) + if msg !== nothing + file = res[i].data[:path] + line = res[i].data[:linenumber] + mod = res[i].data[:module] + push!(locs, (mod, file, line, msg)) + end + end + return locs +end + +function get_broken_docstrings(m::Module) + allpairs = collect(zip(Iterators.repeated(m), names(m; all=true, imported=false))); + broken = [] + locs = [] + done = [m] + + while !isempty(allpairs) + (src, name) = popfirst!(allpairs) + memberobj = try + getfield(src,name) + catch + nothing + end + if memberobj isa Module + if !(memberobj in done) + push!(done, memberobj) + # we only want to consider one pkg + # but note that we still seem to pick up some reexported names + # even though imported=false and the check below + if (pkgdir(memberobj) == pkgdir(m)) + newnames = names(memberobj; all=true, imported=false) + filter!(x->!((memberobj, x) in allpairs || x in done), newnames) + append!(allpairs, collect(zip(Iterators.repeated(memberobj), newnames))) + end + end + elseif !isnothing(memberobj) + docs = Base.Docs.doc(memberobj) + if docs isa Markdown.MD + if has_broken_doctest(docs) !== nothing && !(memberobj in broken) + loc = find_docstr_src(docs) + push!(broken, memberobj) + # we could filter out docs from other packages via startswith(x, pkgdir(m)) + append!(locs, loc) + end + end + end + end + return locs +end + +function (@main)(args) + modnames = length(args) > 0 ? args : ["Oscar"] + mod = getfield.(Ref(Main), Symbol.(modnames)) + locs = reduce(vcat, get_broken_docstrings.(mod)) + isempty(locs) && exit(0) + for (mod, file, line, msg) in locs + dir = joinpath(pkgdir(mod),"") # add trailing / + relfile = replace(file, dir => "") + println("::error file=$relfile,line=$line,title=$(string(mod))::$msg") + end + exit(-1) +end diff --git a/experimental/BasisLieHighestWeight/src/UserFunctions.jl b/experimental/BasisLieHighestWeight/src/UserFunctions.jl index 8a69177f94dc..d9bb839a79ae 100644 --- a/experimental/BasisLieHighestWeight/src/UserFunctions.jl +++ b/experimental/BasisLieHighestWeight/src/UserFunctions.jl @@ -406,7 +406,7 @@ with highest weight `highest_weight` for a simple Lie algebra $L$ of type `type` Furthermore, for each degree, return the monomials that are not contained in the Minkowski sum of the bases of the lower degrees. -!!! warn +!!! warning Currently, this function expects $-w_0(\lambda)$ instead of $\lambda$ as the `highest_weight` input. This might change in a minor release. @@ -515,7 +515,7 @@ with highest weight `highest_weight` for a simple Lie algebra $L$ of type `type` Furthermore, for each degree, return the monomials that are not contained in the Minkowski sum of the bases of the lower degrees. -!!! warn +!!! warning Currently, this function expects $-w_0(\lambda)$ instead of $\lambda$ as the `highest_weight` input. This might change in a minor release. diff --git a/experimental/SetPartitions/src/SetPartition.jl b/experimental/SetPartitions/src/SetPartition.jl index dab1433dc8d7..3bb6a44ec548 100644 --- a/experimental/SetPartitions/src/SetPartition.jl +++ b/experimental/SetPartitions/src/SetPartition.jl @@ -84,6 +84,7 @@ julia> lower_points(set_partition([2, 4], [4, 99])) 2-element Vector{Int64}: 2 3 +``` """ function lower_points(p::SetPartition) return p.lower_points diff --git a/gap/OscarInterface/PackageInfo.g b/gap/OscarInterface/PackageInfo.g index 8a7bbc2c1a8c..70ccf1e30b3d 100644 --- a/gap/OscarInterface/PackageInfo.g +++ b/gap/OscarInterface/PackageInfo.g @@ -10,8 +10,8 @@ SetPackageInfo( rec( PackageName := "OscarInterface", Subtitle := "GAP interface to OSCAR", -Version := "1.2.0", -Date := "30/10/2024", # dd/mm/yyyy format +Version := "1.2.1", +Date := "20/11/2024", # dd/mm/yyyy format License := "GPL-2.0-or-later", Persons := [ diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl index 724c56802dcf..6319cd4d9887 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl @@ -473,3 +473,8 @@ function _change_base_ring(phi::Any, @assert _has_coefficient_map(res_map) return L_red, res_map end + +function Base.hash(X::Scheme, u::UInt) + return u +end + diff --git a/src/AlgebraicGeometry/Schemes/Divisors/AlgebraicCycles.jl b/src/AlgebraicGeometry/Schemes/Divisors/AlgebraicCycles.jl index 82806d80c191..ea7b74e85290 100644 --- a/src/AlgebraicGeometry/Schemes/Divisors/AlgebraicCycles.jl +++ b/src/AlgebraicGeometry/Schemes/Divisors/AlgebraicCycles.jl @@ -534,3 +534,7 @@ function integral(W::AbsAlgebraicCycle; check::Bool=true) return result end +function Base.hash(X::AbsAlgebraicCycle, u::UInt) + return u +end + diff --git a/src/AlgebraicGeometry/Schemes/Divisors/CartierDivisor.jl b/src/AlgebraicGeometry/Schemes/Divisors/CartierDivisor.jl index 34c5e1255791..36f7e74ae448 100644 --- a/src/AlgebraicGeometry/Schemes/Divisors/CartierDivisor.jl +++ b/src/AlgebraicGeometry/Schemes/Divisors/CartierDivisor.jl @@ -530,3 +530,12 @@ function _show_semi_compact(io::IO, C::CartierDivisor, cov::Covering, n::String) print(io, Dedent()) end end + +function Base.hash(X::CartierDivisor, u::UInt) + return u +end + +function Base.hash(X::EffectiveCartierDivisor, u::UInt) + return u +end + diff --git a/src/AlgebraicGeometry/Schemes/Gluing/Methods.jl b/src/AlgebraicGeometry/Schemes/Gluing/Methods.jl index 7024fc902e00..70b9e81c97e4 100644 --- a/src/AlgebraicGeometry/Schemes/Gluing/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/Gluing/Methods.jl @@ -236,3 +236,7 @@ function base_change(phi::Any, G::AbsGluing; return LazyGluing(domain(patch_change1), domain(patch_change2), gd) end +function Base.hash(X::AbsGluing, u::UInt) + return u +end + diff --git a/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Objects/Methods.jl index 20e2c51d5841..cb9bbb3b3543 100644 --- a/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Objects/Methods.jl @@ -433,5 +433,8 @@ function Base.union(comp::Vector{<:AbsProjectiveScheme}) return result end +function Base.hash(X::AbsProjectiveScheme, u::UInt) + return u +end diff --git a/src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl b/src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl index 2bf4fb32bdc8..cdd99771ec45 100644 --- a/src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl +++ b/src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl @@ -1116,4 +1116,7 @@ function projectivization(E::AbsCoherentSheaf; return CoveredProjectiveScheme(X, C, on_patches, projective_gluings, check=false) end +function Base.hash(X::AbsCoherentSheaf, u::UInt) + return u +end diff --git a/src/Combinatorics/EnumerativeCombinatorics/tableaux.jl b/src/Combinatorics/EnumerativeCombinatorics/tableaux.jl index 522c13f0fdbb..61aa41ad3241 100644 --- a/src/Combinatorics/EnumerativeCombinatorics/tableaux.jl +++ b/src/Combinatorics/EnumerativeCombinatorics/tableaux.jl @@ -48,7 +48,7 @@ young_tableau function young_tableau(::Type{T}, v::Vector{Vector{TT}}; check::Bool = true) where {T <: IntegerUnion, TT <: IntegerUnion} if check - @req _defines_partition(map(length, v)) "The input does not define a Young tableau" + @req _defines_partition(map(length, v)) "The input does not define a Young tableau: lengths of rows must be weakly decreasing" end return YoungTableau{T}(v) end @@ -222,20 +222,24 @@ Return the shape of the tableau `tab`, i.e. the partition given by the lengths of the rows of the tableau. """ function shape(tab::YoungTableau{T}) where T - return partition(T[ length(tab[i]) for i = 1:length(tab) ], check = false) + # Line below DOES NOT CHECK that the lengths of the rows are weakly decreasing + return partition(T[ length(tab[i]) for i = 1:length(tab) ]; check = false) end @doc raw""" weight(tab::YoungTableau) -Return the weight of the tableau `tab` as an array whose `i`-th element gives -the number of times the integer `i` appears in the tableau. +Return the weight sequence of the tableau `tab` as an array whose `i`-th element +gives the number of times the integer `i` appears in the tableau. """ function weight(tab::YoungTableau) + @req is_semistandard(tab) "Tableau must be (semi-)standard" + if isempty(tab) return Int[] end + # Computation of max must be changed if we want to permit non-semi-standard YT max = 0 for i = 1:length(tab) if max < tab[i][end] diff --git a/src/Combinatorics/Matroids/ChowRings.jl b/src/Combinatorics/Matroids/ChowRings.jl index 6e98d0cec084..dbcefb19380c 100644 --- a/src/Combinatorics/Matroids/ChowRings.jl +++ b/src/Combinatorics/Matroids/ChowRings.jl @@ -3,7 +3,7 @@ Return the Chow ring of a matroid, optionally also with the simplicial generators and the polynomial ring. -See [AHK18](@cite) and [BES19](@cite). +See [AHK18](@cite) and [BES23](@cite). # Examples The following computes the Chow ring of the Fano matroid. @@ -141,7 +141,7 @@ end @doc raw""" augmented_chow_ring(M::Matroid) -Return an augmented Chow ring of a matroid. As described in [BHMPW20](@cite). +Return an augmented Chow ring of a matroid. As described in [BHMPW22](@cite). # Examples ```jldoctest diff --git a/src/Combinatorics/Matroids/matroids.jl b/src/Combinatorics/Matroids/matroids.jl index 4e028825fd1f..af2a530d4556 100644 --- a/src/Combinatorics/Matroids/matroids.jl +++ b/src/Combinatorics/Matroids/matroids.jl @@ -278,9 +278,9 @@ function matroid_from_hyperplanes(hyperplanes::Union{AbstractVector{T},AbstractS end @doc raw""" - matroid_from_matrix_columns(A::MatrixElem) + matroid_from_matrix_columns(A::MatrixElem; check::Bool=true) -A matroid represented by the column vectors of a matrix `A`. +A matroid represented by the column vectors of a matrix `A`. The value of `check` is currently ignored. See Section 1.1 of [Oxl11](@cite). @@ -310,13 +310,13 @@ function matroid_from_matrix_columns(A::MatrixElem; check::Bool=true) end end - return matroid_from_bases(bases, ncols(A); check=check) + return matroid_from_bases(bases, ncols(A); check=false) end @doc raw""" - matroid_from_matrix_columns(A::MatrixElem) + matroid_from_matrix_rows(A::MatrixElem, check::Bool=true) -A matroid represented by the row vectors of a matrix. +A matroid represented by the row vectors of a matrix. The value of `check` is currently ignored. See Section 1.1 of [Oxl11](@cite). diff --git a/src/Combinatorics/Matroids/properties.jl b/src/Combinatorics/Matroids/properties.jl index 56bf952a350f..addae6cad2e0 100644 --- a/src/Combinatorics/Matroids/properties.jl +++ b/src/Combinatorics/Matroids/properties.jl @@ -1059,11 +1059,9 @@ julia> matroid_hex(fano_matroid()) function matroid_hex(M::Matroid) rvlx = min_revlex_basis_encoding(M) r,n = rank(M), length(M) + v = zeros(Int, 4*ceil(Int, length(rvlx)/4)) + v[length(v)-length(rvlx)+1:end] = _revlex_basis_to_vector(rvlx) - v = _revlex_basis_to_vector(rvlx) - for _ in 1:(4-length(v)%4) - pushfirst!(v,0) - end v = reshape(v,4,:) v = [string(parse(Int, join(v[:, j]), base=2), base=16) for j in 1:size(v)[2]] diff --git a/src/Groups/homomorphisms.jl b/src/Groups/homomorphisms.jl index e42a1cc7d151..6b1424491325 100644 --- a/src/Groups/homomorphisms.jl +++ b/src/Groups/homomorphisms.jl @@ -9,7 +9,7 @@ function Base.show(io::IO, x::GAPGroupHomomorphism) end -function ==(f::GAPGroupHomomorphism{S,T}, g::GAPGroupHomomorphism{S,T}) where S where T +function ==(f::GAPGroupHomomorphism, g::GAPGroupHomomorphism) return GapObj(f) == GapObj(g) end diff --git a/src/Groups/sub.jl b/src/Groups/sub.jl index b107a3062912..95162c68fa3c 100644 --- a/src/Groups/sub.jl +++ b/src/Groups/sub.jl @@ -157,15 +157,7 @@ end # convert a GAP list of subgroups into a vector of Julia groups objects function _as_subgroups(G::T, subs::GapObj) where T <: GAPGroup - res = Vector{T}(undef, length(subs)) - for i = 1:length(res) - res[i] = _as_subgroup_bare(G, subs[i]::GapObj) - end - return res -end - -function _as_subgroups(G::PcGroup, subs::GapObj) - res = Vector{SubPcGroup}(undef, length(subs)) + res = Vector{sub_type(T)}(undef, length(subs)) for i = 1:length(res) res[i] = _as_subgroup_bare(G, subs[i]::GapObj) end diff --git a/src/NumberTheory/NmbThy.jl b/src/NumberTheory/NmbThy.jl index 7f8921b85823..d82d3142dab6 100644 --- a/src/NumberTheory/NmbThy.jl +++ b/src/NumberTheory/NmbThy.jl @@ -126,10 +126,10 @@ end norm_equation(R::AbsNumFieldOrder, k::Base.Integer; abs::Bool = false) = norm_equation(R, ZZRingElem(k), abs = abs) -function norm_equation_fac_elem(R::Hecke.RelNumFieldOrder{AbsSimpleNumFieldElem,Hecke.AbsSimpleNumFieldOrderFractionalIdeal}, a::AbsNumFieldOrderElem{AbsSimpleNumField,AbsSimpleNumFieldElem}) +function norm_equation_fac_elem(R::Hecke.RelNumFieldOrder{AbsSimpleNumFieldElem,Hecke.AbsSimpleNumFieldOrderFractionalIdeal}, a::AbsSimpleNumFieldOrderElem) @assert Hecke.is_maximal(R) - Ka, mKa, mkK = absolute_field(Hecke.nf(R)) + Ka, mKa, mkK = collapse_top_layer(Hecke.nf(R)) Ra = maximal_order(Ka) class_group(Ra) k = Hecke.nf(parent(a)) @@ -144,9 +144,9 @@ function norm_equation_fac_elem(R::Hecke.RelNumFieldOrder{AbsSimpleNumFieldElem, q, mms = snf(q) mq = mq*inv(mms) - C = vcat([matrix(FlintZZ, 1, ngens(q), [valuation(mS(preimage(mq, q[i])), p) for i=1:ngens(q)]) for p = keys(lp)]) + C = reduce(vcat, (matrix(FlintZZ, 1, ngens(q), [valuation(mS(preimage(mq, q[i])), p) for i=1:ngens(q)]) for p = keys(lp))) - A = vcat([matrix(FlintZZ, 1, ngens(q), [valuation(norm(mkK, mS(preimage(mq, g))), p) for g in gens(q)]) for p = keys(la)]) + A = reduce(vcat, (matrix(FlintZZ, 1, ngens(q), [valuation(norm(mkK, mS(preimage(mq, g))), p) for g in gens(q)]) for p = keys(la))) b = matrix(FlintZZ, length(la), 1, [valuation(a, p) for p = keys(la)]) so = solve_mixed(A, b, C) @@ -168,9 +168,9 @@ function norm_equation_fac_elem(R::Hecke.RelNumFieldOrder{AbsSimpleNumFieldElem, return sol end -norm_equation(R::Hecke.RelNumFieldOrder{AbsSimpleNumFieldElem,Hecke.AbsSimpleNumFieldOrderFractionalIdeal}, a::AbsNumFieldOrderElem{AbsSimpleNumField,AbsSimpleNumFieldElem}) = map(x -> R(evaluate(x)), norm_equation_fac_elem(R, a)) +norm_equation(R::Hecke.RelNumFieldOrder{AbsSimpleNumFieldElem,Hecke.AbsSimpleNumFieldOrderFractionalIdeal}, a::AbsSimpleNumFieldOrderElem) = map(x -> R(evaluate(x)), norm_equation_fac_elem(R, a)) -function is_irreducible(a::AbsNumFieldOrderElem{AbsSimpleNumField,AbsSimpleNumFieldElem}) +function is_irreducible(a::AbsSimpleNumFieldOrderElem) if iszero(a) return false end @@ -206,11 +206,11 @@ function is_irreducible(a::AbsNumFieldOrderElem{AbsSimpleNumField,AbsSimpleNumFi end @doc raw""" - irreducibles(S::Vector{AbsNumFieldOrderIdeal{AbsSimpleNumField,AbsSimpleNumFieldElem}}) -> Vector{AbsNumFieldOrderElem} + irreducibles(S::Vector{AbsSimpleNumFieldOrderIdeal}) -> Vector{AbsNumFieldOrderElem} Return all irreducibles whose support is contained in $S$. """ -function irreducibles(S::Vector{AbsNumFieldOrderIdeal{AbsSimpleNumField,AbsSimpleNumFieldElem}}) +function irreducibles(S::Vector{AbsSimpleNumFieldOrderIdeal}) if length(S) == 0 return [] end @@ -268,11 +268,11 @@ end =# @doc raw""" - factorizations(a::AbsNumFieldOrderElem{AbsSimpleNumField,AbsSimpleNumFieldElem}) -> Vector{Fac{OrdElem}} + factorizations(a::AbsSimpleNumFieldOrderElem) -> Vector{Fac{OrdElem}} Return all factorizations of $a$ into irreducibles. """ -function factorizations(a::AbsNumFieldOrderElem{AbsSimpleNumField,AbsSimpleNumFieldElem}) +function factorizations(a::AbsSimpleNumFieldOrderElem) O = parent(a) S = collect(keys(factor(a*O))) if length(S) == 0 @@ -302,7 +302,7 @@ function factorizations(a::AbsNumFieldOrderElem{AbsSimpleNumField,AbsSimpleNumFi end end sol = solve_non_negative(A, b) - res = Fac{AbsNumFieldOrderElem{AbsSimpleNumField,AbsSimpleNumFieldElem}}[] + res = Fac{AbsSimpleNumFieldOrderElem}[] for j=1:nrows(sol) x = Dict{typeof(a), Int}() y = a diff --git a/src/PolyhedralGeometry/Cone/properties.jl b/src/PolyhedralGeometry/Cone/properties.jl index 9aaf989ef0cb..6e56e125921c 100644 --- a/src/PolyhedralGeometry/Cone/properties.jl +++ b/src/PolyhedralGeometry/Cone/properties.jl @@ -534,7 +534,7 @@ is_fulldimensional(C::Cone) = pm_object(C).FULL_DIM::Bool Return the facets of `C` in the format defined by `as`. The allowed values for `as` are -* `Halfspace`, +* `Halfspace` (or its subtype `LinearHalfspace`), * `Cone`. # Examples diff --git a/src/PolyhedralGeometry/Polyhedron/properties.jl b/src/PolyhedralGeometry/Polyhedron/properties.jl index a7ad3ae9656a..c400ea1bce88 100644 --- a/src/PolyhedralGeometry/Polyhedron/properties.jl +++ b/src/PolyhedralGeometry/Polyhedron/properties.jl @@ -491,7 +491,7 @@ end Return the facets of `P` in the format defined by `as`. The allowed values for `as` are -* `Halfspace`, +* `Halfspace` (or its subtype `AffineHalfspace`), * `Polyhedron`, * `Pair`. diff --git a/src/Rings/mpoly-ideals.jl b/src/Rings/mpoly-ideals.jl index 629681cc028c..6f69dd8d0068 100644 --- a/src/Rings/mpoly-ideals.jl +++ b/src/Rings/mpoly-ideals.jl @@ -1203,17 +1203,27 @@ function minimal_primes( # This will in many cases lead to an easy simplification of the problem if factor_generators - J = typeof(I)[ideal(R, elem_type(R)[])] + J = [ideal(R, gens(I))] # A copy of I as initialization for g in gens(I) K = typeof(I)[] is_zero(g) && continue for (b, k) in factor(g) + # Split the already collected components with b for j in J push!(K, j + ideal(R, b)) end end J = K end + + unique_comp = typeof(I)[] + for q in J + is_one(q) && continue + q in unique_comp && continue + push!(unique_comp, q) + end + J = unique_comp + # unique! seems to fail here. We have to do it manually. pre_result = filter!(!is_one, vcat([minimal_primes(j; algorithm, factor_generators=false) for j in J]...)) result = typeof(I)[] @@ -2110,7 +2120,8 @@ function small_generating_set( computed_gb = IdealGens(ring, sing_gb, true) if !haskey(I.gb,computed_gb.ord) # if not yet present, store gb for later use - I.gb[computed_gb.ord] = computed_gb + I.gb[computed_gb.ord] = computed_gb + I.gb[computed_gb.ord].isGB = true end # we do not have a notion of minimal generating set in this context! @@ -2328,4 +2339,3 @@ end function hash(I::Ideal, c::UInt) return hash(base_ring(I), c) end - diff --git a/src/Serialization/Fields.jl b/src/Serialization/Fields.jl index 4176250d0e58..043ff7c23184 100644 --- a/src/Serialization/Fields.jl +++ b/src/Serialization/Fields.jl @@ -191,7 +191,7 @@ function save_object(s::SerializerState, K::FqField) save_object(s, order(K)) else save_data_dict(s) do - save_typed_object(s, defining_polynomial(K)) + save_typed_object(s, defining_polynomial(K), :def_pol) end end end @@ -202,7 +202,7 @@ function load_object(s::DeserializerState, ::Type{<: FqField}) order = ZZRingElem(node) return finite_field(order)[1] else - def_pol = load_typed_object(s) + def_pol = load_typed_object(s, :def_pol) return finite_field(def_pol, cached=false)[1] end end diff --git a/src/Serialization/Upgrades/1.2.1.jl b/src/Serialization/Upgrades/1.2.1.jl new file mode 100644 index 000000000000..3e33f35c831f --- /dev/null +++ b/src/Serialization/Upgrades/1.2.1.jl @@ -0,0 +1,24 @@ +push!(upgrade_scripts_set, UpgradeScript( + v"1.2.1", + function upgrade_1_2_1(s::UpgradeState, dict::Dict) + upgraded_dict = dict + if haskey(dict, :_type) && dict[:_type] == "FqField" + if dict[:data] isa Dict + if !(haskey(dict[:data], :def_pol)) + upgraded_dict[:data][:def_pol] = copy(dict[:data]) + end + end + elseif haskey(dict, :data) && dict[:data] isa Dict + upgraded_dict[:data] = upgrade_1_2_1(s, dict[:data]) + end + if haskey(dict, :_refs) + upgraded_refs = Dict() + for (k, v) in dict[:_refs] + upgraded_refs[k] = upgrade_1_2_1(s, v) + end + upgraded_dict[:_refs] = upgraded_refs + end + + return upgraded_dict + end +)) diff --git a/src/Serialization/Upgrades/main.jl b/src/Serialization/Upgrades/main.jl index fa297ff5e03f..40c9f321aa08 100644 --- a/src/Serialization/Upgrades/main.jl +++ b/src/Serialization/Upgrades/main.jl @@ -141,6 +141,7 @@ include("0.13.0.jl") include("0.15.0.jl") include("1.1.0.jl") include("1.2.0.jl") +include("1.2.1.jl") const upgrade_scripts = collect(upgrade_scripts_set) sort!(upgrade_scripts; by=version) diff --git a/test/Combinatorics/EnumerativeCombinatorics/tableaux.jl b/test/Combinatorics/EnumerativeCombinatorics/tableaux.jl index c3f539917395..16d1f844c703 100644 --- a/test/Combinatorics/EnumerativeCombinatorics/tableaux.jl +++ b/test/Combinatorics/EnumerativeCombinatorics/tableaux.jl @@ -6,9 +6,9 @@ @test reading_word(young_tableau(Array{Int,1}[])) == Int[] # weight - @test weight(young_tableau([[1,2,3],[1,2],[1]])) == [3,2,1] + @test weight(young_tableau([[1,2,3],[2,3],[3]])) == [1,2,3] @test weight(young_tableau([[1,2,3,4,5]])) == [1,1,1,1,1] - @test weight(young_tableau([[1],[1],[1]])) == [3] + @test_throws ArgumentError weight(young_tableau([[1],[1],[1]])) @test weight(young_tableau(Array{Int,1}[])) == Int[] # is_standard diff --git a/test/Combinatorics/Matroids/Matroids.jl b/test/Combinatorics/Matroids/Matroids.jl index 94474e845106..5cd0f76521dc 100644 --- a/test/Combinatorics/Matroids/Matroids.jl +++ b/test/Combinatorics/Matroids/Matroids.jl @@ -422,10 +422,17 @@ @testset "matroid_hex" begin M = fano_matroid() N = uniform_matroid(2, 4) + NN = uniform_matroid(1, 4) M1 = matroid_from_matroid_hex(matroid_hex(M)) N1 = matroid_from_matroid_hex(matroid_hex(N)) + NN1 = matroid_from_matroid_hex(matroid_hex(NN)) + @test is_isomorphic(M, M1) @test is_isomorphic(N, N1) + + @test matroid_hex(NN) == "r1n4_f" + @test is_isomorphic(NN, NN1) + end end diff --git a/test/Groups/subgroups_and_cosets.jl b/test/Groups/subgroups_and_cosets.jl index abf2fcea09b9..298fc50958c0 100644 --- a/test/Groups/subgroups_and_cosets.jl +++ b/test/Groups/subgroups_and_cosets.jl @@ -1,29 +1,41 @@ @testset "Subgroups" begin - G = symmetric_group(7) - x = cperm(G,[1,2,3,4,5,6,7]) - y = cperm(G,[1,2,3]) - z = cperm(G,[1,2]) - - H,f=sub(G,[x,y]) - K,g=sub(x,y) - @test H isa PermGroup - @test H==alternating_group(7) - @test domain(f)==H - @test codomain(f)==G - @test [f(x) for x in gens(H)]==gens(H) - @test (H,f)==(K,g) - @test is_subset(K, G) - flag, emb = is_subgroup(K, G) - @test flag - @test g == emb - @test g == embedding(K, G) - @test K === domain(emb) - @test G === codomain(emb) - @test is_normal_subgroup(H, G) - H,f=sub(G,[x,z]) - @test H==G - @test f==id_hom(G) + S = symmetric_group(7) + Sx = cperm(S, [1, 2, 3, 4, 5, 6, 7]) + Sy = cperm(S, [1, 2, 3]) + Sz = cperm(S, [1, 2]) + + for T in [PermGroup, FPGroup] + iso = isomorphism(T, S) + G = codomain(iso) + x = iso(Sx) + y = iso(Sy) + z = iso(Sz) + + H, f = sub(G, [x, y]) + K, g = sub(x, y) + @test H isa Oscar.sub_type(T) + @test domain(f) == H + @test codomain(f) == G + @test [f(x) for x in gens(H)] == gens(H) + @test (H, f) == (K, g) + @test is_subset(K, G) + flag, emb = is_subgroup(K, G) + @test flag + @test g == emb + @test g == embedding(K, G) + @test K === domain(emb) + @test G === codomain(emb) + @test is_normal_subgroup(H, G) + H, f = sub(G, [x, z]) + @test H == G + @test f == id_hom(G) + end + G = symmetric_group(7) + x = cperm(G, [1, 2, 3, 4, 5, 6, 7]) + y = cperm(G, [1, 2, 3]) + H, f = sub(G, [x, y]) + @test H == alternating_group(7) @test !is_subset(symmetric_group(8), G) @test_throws ArgumentError embedding(symmetric_group(8), G) diff --git a/test/NumberTheory/nmbthy.jl b/test/NumberTheory/nmbthy.jl index f4e628df5ccc..bc6790ac17a3 100644 --- a/test/NumberTheory/nmbthy.jl +++ b/test/NumberTheory/nmbthy.jl @@ -4,7 +4,8 @@ using Test function evalu(x::Fac) return x.unit * prod(p*k for (p,k) = x.fac) end -@testset "Polymake.factorizations" begin + +@testset "factorizations" begin k, a = quadratic_field(-5) zk = maximal_order(k) f = factorizations(zk(6)) @@ -12,7 +13,7 @@ end @test all(x -> evalu(x) == 6, f) end -@testset "Polymake.norm_equation" begin +@testset "norm_equation.absolute" begin k, a = wildanger_field(3, 13) zk = maximal_order(k) na = norm(rand(zk, 1:10)) @@ -20,6 +21,18 @@ end @test all(x->norm(x) == na, s) end +@testset "norm_equation.relative" begin + L, _ = quadratic_field(-1) + _, x = L[:x] + f = x^3 - 2; + k, _ = number_field(f) + + zk = maximal_order(k) + na = norm(rand(zk, 10)) + s = norm_equation(zk, na) + @test all(x->norm(x) == na, s) +end + @testset "DiscreteLog" begin F = GF(3,4); diff --git a/test/Rings/mpoly.jl b/test/Rings/mpoly.jl index 8c81bdd1d30b..1f9c33a9dcae 100644 --- a/test/Rings/mpoly.jl +++ b/test/Rings/mpoly.jl @@ -159,7 +159,6 @@ end l = minimal_primes(i, algorithm=:charSets) @test length(l) == 2 @test l[1] == i1 && l[2] == i2 || l[1] == i2 && l[2] == i1 - R, (a, b, c, d) = polynomial_ring(ZZ, [:a, :b, :c, :d]) i = ideal(R, [R(9), (a+3)*(b+3)]) i1 = ideal(R, [R(3), a]) @@ -232,6 +231,19 @@ end R, (x, y) = polynomial_ring(QQ, [:x, :y]) I = ideal(R, [one(R)]) @test is_prime(I) == false + + J = ideal(R, [x*(x-1), y*(y-1), x*y]) + l = minimal_primes(J) + @test length(l) == 3 + + QQt, t = QQ[:t] + kk, a = extension_field(t^2 + 1) + + R, (x, y) = kk[:x, :y] + J = ideal(R, [x^2 + 1, y^2 + 1, (x - a)*(y - a)]) + l = minimal_primes(J) + @test length(l) == 3 + end @testset "Groebner" begin @@ -601,4 +613,3 @@ end I = ideal(P, elem_type(P)[]) @test !radical_membership(x, I) end - diff --git a/test/Serialization/loading.jl b/test/Serialization/loading.jl index 299688d5f1b3..346bcd4b4245 100644 --- a/test/Serialization/loading.jl +++ b/test/Serialization/loading.jl @@ -1,17 +1,25 @@ @testset "loading" begin - - @testset "loading Vector{LinearProgram}" begin - c = cube(3) - LP0 = linear_program(c, [2,2,-3]) - LP1 = linear_program(c, [2,2,4]) - v = [LP0, LP1] - loaded = load(joinpath(@__DIR__,"vlp.json")) - @test length(v) == length(loaded) - @test feasible_region(loaded[1]) == feasible_region(loaded[2]) - @test feasible_region(loaded[1]) == feasible_region(LP0) - @test objective_function(loaded[1]) == objective_function(v[1]) - @test objective_function(loaded[2]) == objective_function(v[2]) - @test optimal_value(loaded[1]) == optimal_value(v[1]) - @test optimal_value(loaded[2]) == optimal_value(v[2]) - end + @testset "loading file format paper example" begin + F = GF(7, 2) + o = gen(F) + Fyz, (y, z) = F[:x, :y] + load(joinpath(@__DIR__,"polynomial-example.mrdi");) + loaded = load(joinpath(@__DIR__,"polynomial-example.mrdi"); params=Fyz) + @test loaded == 2*y^3*z^4 + 5*o*y + (o + 3)*z^2 + 1 + end + + @testset "loading Vector{LinearProgram}" begin + c = cube(3) + LP0 = linear_program(c, [2,2,-3]) + LP1 = linear_program(c, [2,2,4]) + v = [LP0, LP1] + loaded = load(joinpath(@__DIR__,"vlp.json")) + @test length(v) == length(loaded) + @test feasible_region(loaded[1]) == feasible_region(loaded[2]) + @test feasible_region(loaded[1]) == feasible_region(LP0) + @test objective_function(loaded[1]) == objective_function(v[1]) + @test objective_function(loaded[2]) == objective_function(v[2]) + @test optimal_value(loaded[1]) == optimal_value(v[1]) + @test optimal_value(loaded[2]) == optimal_value(v[2]) + end end diff --git a/test/Serialization/polynomial-example.mrdi b/test/Serialization/polynomial-example.mrdi new file mode 100644 index 000000000000..0ad82300e7b4 --- /dev/null +++ b/test/Serialization/polynomial-example.mrdi @@ -0,0 +1,36 @@ +{ + "_ns": { "Oscar": [ "https://github.com/oscar-system/Oscar.jl", "1.0.0" ] }, + "_type": { + "name": "MPolyRingElem", + "params": "869a359a-43d3-43f4-9821-0af9346be019" + }, + "data": [[["3", "4"], [["0", "2"]]], + [["0", "2"], [["0", "3"], ["1", "1"]]], + [["1", "0"], [["1", "5"]]], + [["0", "0"], [["0", "1"]]]], + "_refs": { + "152ac7bd-e85a-4b36-acc2-743ade2cad4f": { + "data": { "base_ring": { "data": "7", "_type": "FqField"}, + "symbols": ["x"] }, + "_type": "PolyRing" + }, + "869a359a-43d3-43f4-9821-0af9346be019": { + "data": { + "base_ring": "a8309b96-caec-443c-bedb-e23bb0634c14", + "symbols": [ "y", "z" ] + }, + "_type": "MPolyRing" }, + "a8309b96-caec-443c-bedb-e23bb0634c14": { + "data": { + "def_pol": { + "data": [["0", "1"], ["2", "1"]], + "_type": { + "name": "PolyRingElem", + "params": "152ac7bd-e85a-4b36-acc2-743ade2cad4f" + } + } + }, + "_type": "FqField" + } + } +} diff --git a/test/Serialization/upgrades/GF_2.json b/test/Serialization/upgrades/GF_2.json new file mode 100644 index 000000000000..812d8d1a467c --- /dev/null +++ b/test/Serialization/upgrades/GF_2.json @@ -0,0 +1,11 @@ +{ + "_ns": { + "Oscar": [ + "https://github.com/oscar-system/Oscar.jl", + "1.2.0" + ] + }, + "_type": "FqField", + "data": "2", + "id": "4e298c21-11cb-45f1-bac0-62e2df5e6454" +} diff --git a/test/Serialization/upgrades/GF_2_2.json b/test/Serialization/upgrades/GF_2_2.json new file mode 100644 index 000000000000..51d9a4e6b4da --- /dev/null +++ b/test/Serialization/upgrades/GF_2_2.json @@ -0,0 +1,45 @@ +{ + "_ns": { + "Oscar": [ + "https://github.com/oscar-system/Oscar.jl", + "1.2.0" + ] + }, + "_refs": { + "15ec4d5e-409d-4e80-a7a2-aa1b22b0db9d": { + "_type": "PolyRing", + "data": { + "base_ring": "4e298c21-11cb-45f1-bac0-62e2df5e6454", + "symbols": [ + "x" + ] + } + }, + "4e298c21-11cb-45f1-bac0-62e2df5e6454": { + "_type": "FqField", + "data": "2" + } + }, + "_type": "FqField", + "data": { + "_type": { + "name": "PolyRingElem", + "params": "15ec4d5e-409d-4e80-a7a2-aa1b22b0db9d" + }, + "data": [ + [ + "0", + "1" + ], + [ + "1", + "1" + ], + [ + "2", + "1" + ] + ] + }, + "id": "b2e7bf06-d89a-4fea-8bf4-215a61c16ca2" +} diff --git a/test/Serialization/upgrades/poly1.0.5.json b/test/Serialization/upgrades/poly1.0.5.json new file mode 100644 index 000000000000..b26acd897b02 --- /dev/null +++ b/test/Serialization/upgrades/poly1.0.5.json @@ -0,0 +1,110 @@ +{ + "_ns": { + "Oscar": [ + "https://github.com/oscar-system/Oscar.jl", + "1.0.5" + ] + }, + "_type": { + "name": "MPolyRingElem", + "params": "f0885e3e-71ff-4813-88fd-7ee05eeb3657" + }, + "data": [ + [ + [ + "3", + "4" + ], + [ + [ + "0", + "2" + ] + ] + ], + [ + [ + "1", + "0" + ], + [ + [ + "1", + "5" + ] + ] + ], + [ + [ + "0", + "2" + ], + [ + [ + "0", + "3" + ], + [ + "1", + "1" + ] + ] + ], + [ + [ + "0", + "0" + ], + [ + [ + "0", + "1" + ] + ] + ] + ], + "_refs": { + "f0885e3e-71ff-4813-88fd-7ee05eeb3657": { + "_type": "MPolyRing", + "data": { + "base_ring": "e06a6ac9-954b-4fb7-89c6-f2a25489440e", + "symbols": [ + "y", + "z" + ] + } + }, + "e06a6ac9-954b-4fb7-89c6-f2a25489440e": { + "_type": "FqField", + "data": { + "_type": { + "name": "PolyRingElem", + "params": "3a66dcbd-bd73-4bb7-8b99-42d9f5177893" + }, + "data": [ + [ + "0", + "1" + ], + [ + "2", + "1" + ] + ] + } + }, + "3a66dcbd-bd73-4bb7-8b99-42d9f5177893": { + "_type": "PolyRing", + "data": { + "base_ring": "221dfa92-69df-4b5a-8f30-166aafddfaa9", + "symbols": [ + "x" + ] + } + }, + "221dfa92-69df-4b5a-8f30-166aafddfaa9": { + "_type": "FqField", + "data": "7" + } + } +} diff --git a/test/Serialization/upgrades/runtests.jl b/test/Serialization/upgrades/runtests.jl index 222da8093629..282678fa9a3c 100644 --- a/test/Serialization/upgrades/runtests.jl +++ b/test/Serialization/upgrades/runtests.jl @@ -27,4 +27,11 @@ loaded = load(joinpath(@__DIR__, "file_version_less_than_1.2.0.json")); @test loaded isa Dict end + + @testset "< 1.2.1 Upgrade" begin + load(joinpath(@__DIR__, "GF_2_2.json")); + load(joinpath(@__DIR__, "GF_2.json")); + Oscar.reset_global_serializer_state() + load(joinpath(@__DIR__, "poly1.0.5.json")); + end end