diff --git a/Project.toml b/Project.toml index 42e24bd2e82f..47369a0277dd 100644 --- a/Project.toml +++ b/Project.toml @@ -24,18 +24,18 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" cohomCalg_jll = "5558cf25-a90e-53b0-b813-cadaa3ae7ade" [compat] -AbstractAlgebra = "0.30.9" -AlgebraicSolving = "0.3.0" +AbstractAlgebra = "0.31.0" +AlgebraicSolving = "0.3.3" DocStringExtensions = "0.8, 0.9" GAP = "0.9.4" -Hecke = "0.18.13" +Hecke = "0.19.2" JSON = "^0.20, ^0.21" -Nemo = "0.34.3" +Nemo = "0.35.1" Polymake = "0.10.0" Preferences = "1" RandomExtensions = "0.4.3" RecipesBase = "1.2.1" -Singular = "0.18.2" +Singular = "0.18.8" TOPCOM_jll = "0.17.8" cohomCalg_jll = "0.32.0" julia = "1.6" diff --git a/experimental/GModule/AlgClosureFp.jl b/experimental/GModule/AlgClosureFp.jl index d8585b125301..1b81f3761a13 100644 --- a/experimental/GModule/AlgClosureFp.jl +++ b/experimental/GModule/AlgClosureFp.jl @@ -113,7 +113,7 @@ function Oscar.roots(a::AlgClosureElem, b::Int) d = mapreduce(degree, lcm, keys(lf.fac), init = 1) d = lcm(d, degree(parent(ad))) K = ext_of_degree(parent(a), d) - r = roots(f, K) + r = roots(K, f) return [AlgClosureElem(x, parent(a)) for x = r] end @@ -126,7 +126,7 @@ function Oscar.roots(a::Generic.Poly{AlgClosureElem{T}}) where T d = mapreduce(degree, lcm, keys(lf.fac), init = 1) d = lcm(d, degree(parent(b[1]))) K = ext_of_degree(A, d) - r = roots(f, K) + r = roots(K, f) return [AlgClosureElem(x, A) for x = r] end diff --git a/experimental/GModule/Cohomology.jl b/experimental/GModule/Cohomology.jl index e62c36d6bcf7..06e17206498e 100644 --- a/experimental/GModule/Cohomology.jl +++ b/experimental/GModule/Cohomology.jl @@ -567,7 +567,7 @@ function H_zero(C::GModule) @assert fl #this is fix, now it "should" be mod by norm? Only for Tate, see below - z = MapFromFunc(x->CoChain{0,elem_type(G),elem_type(M)}(C, Dict(() => inj(x))), y->preimage(inj, y()), k, AllCoChains{0,elem_type(G),elem_type(M)}()) + z = MapFromFunc(k, AllCoChains{0,elem_type(G),elem_type(M)}(), x->CoChain{0,elem_type(G),elem_type(M)}(C, Dict(() => inj(x))), y->preimage(inj, y())) set_attribute!(C, :H_zero => z) return k, z end @@ -594,7 +594,7 @@ function H_zero_tate(C::GModule) q, mq = quo(k, image(inj)[1]) fl, Inj = is_subgroup(k, M) - z = MapFromFunc(x->CoChain{0,elem_type(G),elem_type(M)}(C, Dict(() => Inj(preimage(mq, x)))), y->mq(preimage(Inj, y())), q, AllCoChains{0,elem_type(G),elem_type(M)}()) + z = MapFromFunc(q, AllCoChains{0,elem_type(G),elem_type(M)}(), x->CoChain{0,elem_type(G),elem_type(M)}(C, Dict(() => Inj(preimage(mq, x)))), y->mq(preimage(Inj, y()))) set_attribute!(C, :H_zero_tate => z) if isfinite(G) && isa(q, GrpAbFinGen) @@ -732,8 +732,9 @@ function H_one(C::GModule) G = group(C) z = MapFromFunc( + Q, AllCoChains{1, elem_type(G), elem_type(M)}(), x->CoChain{1,elem_type(G),elem_type(M)}(C, Dict([(gen(G, i),) => pro[i](lft(preimage(mQ, x))) for i=1:ngens(G)])), - y->mQ(preimage(lft, sum(inj[i](y(gen(G, i))) for i=1:n))), Q, AllCoChains{1, elem_type(G), elem_type(M)}()) + y->mQ(preimage(lft, sum(inj[i](y(gen(G, i))) for i=1:n)))) set_attribute!(C, :H_one => z) return Q, z @@ -1333,8 +1334,8 @@ function H_two(C::GModule; force_rws::Bool = false, redo::Bool = false) return mH2(preimage(mE, T)) end - z = (MapFromFunc(x->TailToCoChain(mE(preimage(mH2, x))), - z2, H2, AllCoChains{2,elem_type(G),elem_type(M)}()), + z = (MapFromFunc(H2, AllCoChains{2,elem_type(G),elem_type(M)}(), + x->TailToCoChain(mE(preimage(mH2, x))), z2), # y->TailFromCoChain(y), D, AllCoChains{2,elem_type(G),elem_type(M)}()), is_coboundary) set_attribute!(C, :H_two => z) @@ -1571,9 +1572,9 @@ function pc_group(M::GrpAbFinGen; refine::Bool = true) @assert is_isomorphic(B, fp_group(M)[1]) return B, MapFromFunc( + B, codomain(mM), x->image(mM, gap_to_julia(x.X)), - y->PcGroupElem(B, Julia_to_gap(preimage(mM, y))), - B, codomain(mM)) + y->PcGroupElem(B, Julia_to_gap(preimage(mM, y)))) end function fp_group(::Type{PcGroup}, M::GrpAbFinGen; refine::Bool = true) @@ -1661,9 +1662,9 @@ function pc_group(M::Generic.FreeModule{<:FinFieldElem}; refine::Bool = true) @assert order(B) == order(M) return B, MapFromFunc( + B, M, x->gap_to_julia(x.X), - y->PcGroupElem(B, Julia_to_gap(y)), - B, M) + y->PcGroupElem(B, Julia_to_gap(y))) end diff --git a/experimental/GModule/GModule.jl b/experimental/GModule/GModule.jl index e558aaa9fe8e..cf355299211d 100644 --- a/experimental/GModule/GModule.jl +++ b/experimental/GModule/GModule.jl @@ -381,7 +381,7 @@ function gmodule(k::Nemo.fpField, C::GModule{<:Any, <:Generic.FreeModule{<:FinFi end function Hecke.frobenius(K::FinField, i::Int=1) - MapFromFunc(x->Hecke.frobenius(x, i), y -> Hecke.frobenius(x, degree(K)-i), K, K) + MapFromFunc(K, K, x->Hecke.frobenius(x, i), y -> Hecke.frobenius(x, degree(K)-i)) end function gmodule_minimal_field(C::GModule{<:Any, <:Generic.FreeModule{fpFieldElem}}) @@ -500,7 +500,7 @@ function gmodule_over(::QQField, C::GModule{<:Any, <:Generic.FreeModule{nf_elem} end function Oscar.hom(M::MultGrp, N::MultGrp, h::Map) - return MapFromFunc(x->N(h(x.data)), y->M(preimage(h, y.data)), M, N) + return MapFromFunc(M, N, x->N(h(x.data)), y->M(preimage(h, y.data))) end function Oscar.content_ideal(M::MatElem{nf_elem}) @@ -869,7 +869,7 @@ function Oscar.hom(F::Generic.FreeModule{T}, G::Generic.FreeModule{T}) where T k = base_ring(F) @assert base_ring(G) == k H = free_module(k, dim(F)*dim(G)) - return H, MapFromFunc(x->hom(F, G, matrix(k, dim(F), dim(G), vec(collect(x.v)))), y->H(vec(collect(transpose(mat(y))))), H, Hecke.MapParent(F, G, "homomorphisms")) + return H, MapFromFunc(H, Hecke.MapParent(F, G, "homomorphisms"), x->hom(F, G, matrix(k, dim(F), dim(G), vec(collect(x.v)))), y->H(vec(collect(transpose(mat(y)))))) end function hom_base(C::T, D::T) where T <: GModule{<:Any, <:Generic.FreeModule{<:FinFieldElem}} @@ -1158,7 +1158,7 @@ function Oscar.abelian_group(M::Generic.FreeModule{fqPolyRepFieldElem}) end return M(m) end - return A, MapFromFunc(to_M, to_A, A, M) + return A, MapFromFunc(A, M, to_M, to_A) end function Oscar.group(chi::Oscar.GAPGroupClassFunction) diff --git a/experimental/GModule/GaloisCohomology.jl b/experimental/GModule/GaloisCohomology.jl index a60734d29569..0e52f8c8af22 100644 --- a/experimental/GModule/GaloisCohomology.jl +++ b/experimental/GModule/GaloisCohomology.jl @@ -329,7 +329,7 @@ function Oscar.gmodule(K::Hecke.LocalField, k::Union{Hecke.LocalField, FlintPadi pi = uniformizer(K) return gmodule(G, [hom(A, A, [A[1]]) for g = gens(G)]), mG, - MapFromFunc(x->pi^x[1], y->Int(e*valuation(y))*A[1], A, K) + MapFromFunc(A, K, x->pi^x[1], y->Int(e*valuation(y))*A[1]) end if e % prime(K) != 0 && !full #tame! @@ -355,12 +355,12 @@ function Oscar.gmodule(K::Hecke.LocalField, k::Union{Hecke.LocalField, FlintPadi end return gmodule(G, h), mG, - MapFromFunc(x->pi^x[1] * gk^x[2], + MapFromFunc(A, K, x->pi^x[1] * gk^x[2], function(y) v = Int(e*valuation(y)) y *= pi^-v return v*A[1] + preimage(mu, mk(y))[1]*A[2] - end, A, K) + end) end # @show :wild @@ -614,7 +614,7 @@ function Hecke.extend_easy(m::Hecke.CompletionMap, L::FacElemMon{AnticNumberFiel function from(a::Hecke.LocalFieldElem) return FacElem(preimage(m, a)) end - return MapFromFunc(to, from, L, codomain(m)) + return MapFromFunc(L, codomain(m), to, from) end function Hecke.extend_easy(m::Hecke.CompletionMap, mu::Map, L::FacElemMon{AnticNumberField}) @@ -640,7 +640,7 @@ function Hecke.extend_easy(m::Hecke.CompletionMap, mu::Map, L::FacElemMon{AnticN function from(a::Hecke.LocalFieldElem) return FacElem(preimage(m, mu(a))) end - return MapFromFunc(to, from, L, domain(mu)) + return MapFromFunc(L, domain(mu), to, from) end @@ -746,7 +746,7 @@ function idel_class_gmodule(k::AnticNumberField, s::Vector{Int} = Int[]; redo::B @vprint :GaloisCohomology 2 " .. S-units (for all) ..\n" U, mU = sunit_group_fac_elem(S) I.mU = mU - z = MapFromFunc(x->evaluate(x), y->FacElem(y), codomain(mU), k) + z = MapFromFunc(codomain(mU), k, x->evaluate(x), y->FacElem(y)) E = gmodule(G, mU, mG) Hecke.assure_has_hnf(E.M) @hassert :GaloisCohomology -1 is_consistent(E) @@ -1061,7 +1061,7 @@ function Oscar.completion(I::IdelParent, P::NfAbsOrdIdl) z = findall(pr -> mG(pr)(mKp.P) == P, prm) pr = inv(prm[z[1]]) - nKp = MapFromFunc(x->mKp(mG(pr)(x)), y->mG(inv(pr))(preimage(mKp, y)), I.k, Kp) + nKp = MapFromFunc(I.k, Kp, x->mKp(mG(pr)(x)), y->mG(inv(pr))(preimage(mKp, y))) return Kp, nKp, mGp, mUp, pro * Hecke.canonical_projection(J, z[1]), Hecke.canonical_injection(J, z[1])*inj end @@ -1466,7 +1466,7 @@ function relative_brauer_group(K::AnticNumberField, k::Union{QQField, AnticNumbe G = s mG = ms*mG else - mp = MapFromFunc(x -> K(x), y-> QQ(y), QQ, K) + mp = MapFromFunc(QQ, K, x -> K(x), y-> QQ(y)) end B = RelativeBrauerGroup(mp) B.mG = mG @@ -1498,7 +1498,7 @@ function relative_brauer_group(K::AnticNumberField, k::Union{QQField, AnticNumbe S, mS = sunit_group(lP) MC = Oscar.GrpCoh.MultGrp(K) - mMC = MapFromFunc(x->MC(x), y->y.data, K, MC) + mMC = MapFromFunc(K, MC, x->MC(x), y->y.data) mG = B.mG G = domain(mG) @@ -1548,9 +1548,9 @@ function relative_brauer_group(K::AnticNumberField, k::Union{QQField, AnticNumbe return b end - B.map = MapFromFunc(x->elem_to_cocycle(x), - y->cocycle_to_elem(y), - B, Oscar.GrpCoh.AllCoChains{2, PermGroupElem, Oscar.GrpCoh.MultGrpElem{nf_elem}}()) + B.map = MapFromFunc(B, Oscar.GrpCoh.AllCoChains{2, PermGroupElem, Oscar.GrpCoh.MultGrpElem{nf_elem}}(), + x->elem_to_cocycle(x), + y->cocycle_to_elem(y)) return B, B.map end diff --git a/experimental/GModule/Misc.jl b/experimental/GModule/Misc.jl index bbb636ee115c..918370d304ca 100644 --- a/experimental/GModule/Misc.jl +++ b/experimental/GModule/Misc.jl @@ -19,7 +19,7 @@ function Hecke.number_field(::QQField, a::qqbar; cached::Bool = false) return b end f = minpoly(x) - r = roots(f, k) + r = roots(k, f) pr = 10 while true C = AcbField(pr) @@ -40,7 +40,7 @@ function Hecke.number_field(::QQField, a::qqbar; cached::Bool = false) end #TODO: make map canonical? # ... and return gen(k) instead? - return k, MapFromFunc(to_qqbar, to_k, k, parent(a)) + return k, MapFromFunc(k, parent(a), to_qqbar, to_k) end Base.getindex(::QQField, a::qqbar) = number_field(QQ, a) diff --git a/experimental/GaloisGrp/src/Solve.jl b/experimental/GaloisGrp/src/Solve.jl index 6e193c2492f4..f7562c7a28bd 100644 --- a/experimental/GaloisGrp/src/Solve.jl +++ b/experimental/GaloisGrp/src/Solve.jl @@ -502,7 +502,7 @@ function Oscar.solve(f::ZZPolyRingElem; max_prec::Int=typemax(Int), show_radical K = number_field(fld_arr[length(pp)+1])[1] i = length(pp)+2 if K == QQ - h = MapFromFunc(x->x, y->y, K, K) + h = MapFromFunc(K, K, x->x, y->y) else h = hom(K, K, gen(K)) end diff --git a/experimental/GaloisGrp/src/Subfields.jl b/experimental/GaloisGrp/src/Subfields.jl index 76a1ee01ad64..ffed31bf0282 100644 --- a/experimental/GaloisGrp/src/Subfields.jl +++ b/experimental/GaloisGrp/src/Subfields.jl @@ -7,7 +7,7 @@ import Oscar.GaloisGrp: POSet, POSetElem, GaloisCtx, find_prime, function embedding_hom(k, K) - return MapFromFunc(x->K(x), k, K) + return MapFromFunc(k, K, x->K(x)) end const BlockSystem_t = Vector{Vector{Int}} diff --git a/experimental/LieAlgebras/src/iso_gap_oscar.jl b/experimental/LieAlgebras/src/iso_gap_oscar.jl index aa86cb35ea69..59e71e00e6c7 100644 --- a/experimental/LieAlgebras/src/iso_gap_oscar.jl +++ b/experimental/LieAlgebras/src/iso_gap_oscar.jl @@ -27,7 +27,7 @@ function _iso_gap_oscar_abstract_lie_algebra( LO = _abstract_lie_algebra_from_GAP(LG, coeffs_iso, s; cached) finv, f = _iso_oscar_gap_lie_algebra_functions(LO, LG, inv(coeffs_iso)) - iso = MapFromFunc(f, finv, LG, LO) + iso = MapFromFunc(LG, LO, f, finv) set_attribute!(LO, :iso_oscar_gap => inv(iso)) return iso end @@ -41,7 +41,7 @@ function _iso_gap_oscar_linear_lie_algebra( LO = _linear_lie_algebra_from_GAP(LG, coeffs_iso, s; cached) finv, f = _iso_oscar_gap_lie_algebra_functions(LO, LG, inv(coeffs_iso)) - iso = MapFromFunc(f, finv, LG, LO) + iso = MapFromFunc(LG, LO, f, finv) set_attribute!(LO, :iso_oscar_gap => inv(iso)) return iso end diff --git a/experimental/LieAlgebras/src/iso_oscar_gap.jl b/experimental/LieAlgebras/src/iso_oscar_gap.jl index 36afce24d7bf..fe966839504a 100644 --- a/experimental/LieAlgebras/src/iso_oscar_gap.jl +++ b/experimental/LieAlgebras/src/iso_oscar_gap.jl @@ -32,7 +32,7 @@ function _iso_oscar_gap(LO::LinearLieAlgebra{C}) where {C<:RingElement} f, finv = _iso_oscar_gap_lie_algebra_functions(LO, LG, coeffs_iso) - return MapFromFunc(f, finv, LO, LG) + return MapFromFunc(LO, LG, f, finv) end function _iso_oscar_gap(LO::AbstractLieAlgebra{C}) where {C<:RingElement} @@ -58,5 +58,5 @@ function _iso_oscar_gap(LO::AbstractLieAlgebra{C}) where {C<:RingElement} f, finv = _iso_oscar_gap_lie_algebra_functions(LO, LG, coeffs_iso) - return MapFromFunc(f, finv, LO, LG) + return MapFromFunc(LO, LG, f, finv) end diff --git a/experimental/LinearQuotients/src/linear_quotients.jl b/experimental/LinearQuotients/src/linear_quotients.jl index c11062d58700..4c3b2911fa7c 100644 --- a/experimental/LinearQuotients/src/linear_quotients.jl +++ b/experimental/LinearQuotients/src/linear_quotients.jl @@ -184,7 +184,7 @@ function monomial_valuation(R::MPolyRing{T}, g::MatrixGroupElem{T}, zeta::Tuple{ return minimum(mons) end - return MapFromFunc(val, R, ZZ) + return MapFromFunc(R, ZZ, val) end ################################################################################ diff --git a/experimental/PlaneCurve/src/AffinePlaneCurve.jl b/experimental/PlaneCurve/src/AffinePlaneCurve.jl index d9644d4525b8..d61b74bcab14 100644 --- a/experimental/PlaneCurve/src/AffinePlaneCurve.jl +++ b/experimental/PlaneCurve/src/AffinePlaneCurve.jl @@ -33,13 +33,13 @@ Throw an error if `P` is not a point of `C`, return `false` if `P` is a singular julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) +julia> C = AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) Affine plane curve defined by -x^5 - x^4*y + x^3*y^3 + x^2*y^4 -julia> P = Oscar.Point([QQ(0), QQ(0)]) +julia> P = Point([QQ(0), QQ(0)]) Point with coordinates QQFieldElem[0, 0] -julia> Oscar.is_smooth(C, P) +julia> is_smooth(C, P) false ``` """ @@ -67,13 +67,13 @@ Return the tangent of `C` at `P` when `P` is a smooth point of `C`, and throw an julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) +julia> C = AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) Affine plane curve defined by -x^5 - x^4*y + x^3*y^3 + x^2*y^4 -julia> P2 = Oscar.Point([QQ(2), QQ(-2)]) +julia> P2 = Point([QQ(2), QQ(-2)]) Point with coordinates QQFieldElem[2, -2] -julia> Oscar.tangent(C, P2) +julia> tangent(C, P2) Affine plane curve defined by -48*x - 48*y ``` """ @@ -106,13 +106,13 @@ Return the affine plane curve consisting of the common component of `C` and `D`, julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x*(x+y)*(x^2 + x + 1)) +julia> C = AffinePlaneCurve(x*(x+y)*(x^2 + x + 1)) Affine plane curve defined by x^4 + x^3*y + x^3 + x^2*y + x^2 + x*y -julia> D = Oscar.AffinePlaneCurve(x*(x+y)*(x-y)) +julia> D = AffinePlaneCurve(x*(x+y)*(x-y)) Affine plane curve defined by x^3 - x*y^2 -julia> Oscar.common_components(C, D) +julia> common_components(C, D) 1-element Vector{AffinePlaneCurve{QQFieldElem}}: Affine plane curve defined by x^2 + x*y ``` @@ -142,13 +142,13 @@ Return a list whose first element is the affine plane curve defined by the gcd o julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x*(x+y)) +julia> C = AffinePlaneCurve(x*(x+y)) Affine plane curve defined by x^2 + x*y -julia> D = Oscar.AffinePlaneCurve((x-y)*(x-2)) +julia> D = AffinePlaneCurve((x-y)*(x-2)) Affine plane curve defined by x^2 - x*y - 2*x + 2*y -julia> Oscar.curve_intersect(C, D) +julia> curve_intersect(C, D) 2-element Vector{Vector}: AffinePlaneCurve[] Point{QQFieldElem}[Point with coordinates QQFieldElem[0, 0], Point with coordinates QQFieldElem[2, -2]] @@ -235,10 +235,10 @@ Return the reduced singular locus of `C` as a list whose first element is the af julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) +julia> C = AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) Affine plane curve defined by -x^5 - x^4*y + x^3*y^3 + x^2*y^4 -julia> Oscar.curve_singular_locus(C) +julia> curve_singular_locus(C) 2-element Vector{Vector}: AffinePlaneCurve[Affine plane curve defined by x] Point[Point with coordinates QQFieldElem[-1, 1], Point with coordinates QQFieldElem[0, 0]] @@ -321,17 +321,17 @@ Return the multiplicity of `C` at `P`. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) +julia> C = AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) Affine plane curve defined by -x^5 - x^4*y + x^3*y^3 + x^2*y^4 -julia> P = Oscar.Point([QQ(2), QQ(-2)]) +julia> P = Point([QQ(2), QQ(-2)]) Point with coordinates QQFieldElem[2, -2] -julia> Oscar.multiplicity(C, P) +julia> multiplicity(C, P) 1 ``` """ -function multiplicity(C::AffinePlaneCurve{S}, P::Point{S}) where S <: FieldElem +function Oscar.multiplicity(C::AffinePlaneCurve{S}, P::Point{S}) where S <: FieldElem P.ambient_dim == 2 || error("The point needs to be in a two dimensional space") D = curve_map_point_origin(C, P) G = D.eq @@ -357,13 +357,13 @@ Return the tangent lines at `P` to `C` with their multiplicity. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) +julia> C = AffinePlaneCurve(x^2*(x+y)*(y^3-x^2)) Affine plane curve defined by -x^5 - x^4*y + x^3*y^3 + x^2*y^4 -julia> P = Oscar.Point([QQ(0), QQ(0)]) +julia> P = Point([QQ(0), QQ(0)]) Point with coordinates QQFieldElem[0, 0] -julia> Oscar.tangent_lines(C, P) +julia> tangent_lines(C, P) Dict{AffinePlaneCurve{QQFieldElem}, Int64} with 2 entries: x => 4 x + y => 1 @@ -422,16 +422,16 @@ Return the intersection multiplicity of `C` and `D` at `P`. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve((x^2+y^2)*(x^2 + y^2 + 2*y)) +julia> C = AffinePlaneCurve((x^2+y^2)*(x^2 + y^2 + 2*y)) Affine plane curve defined by x^4 + 2*x^2*y^2 + 2*x^2*y + y^4 + 2*y^3 -julia> D = Oscar.AffinePlaneCurve((x^2+y^2)*(y^3*x^6 - y^6*x^2)) +julia> D = AffinePlaneCurve((x^2+y^2)*(y^3*x^6 - y^6*x^2)) Affine plane curve defined by x^8*y^3 + x^6*y^5 - x^4*y^6 - x^2*y^8 -julia> Q = Oscar.Point([QQ(0), QQ(-2)]) +julia> Q = Point([QQ(0), QQ(-2)]) Point with coordinates QQFieldElem[0, -2] -julia> Oscar.intersection_multiplicity(C, D, Q) +julia> intersection_multiplicity(C, D, Q) 2 ``` """ @@ -458,22 +458,22 @@ Return `true` if `C` and `D` intersect transversally at `P` and `false` otherwis julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x*(x+y)) +julia> C = AffinePlaneCurve(x*(x+y)) Affine plane curve defined by x^2 + x*y -julia> D = Oscar.AffinePlaneCurve((x-y)*(x-2)) +julia> D = AffinePlaneCurve((x-y)*(x-2)) Affine plane curve defined by x^2 - x*y - 2*x + 2*y -julia> P = Oscar.Point([QQ(0), QQ(0)]) +julia> P = Point([QQ(0), QQ(0)]) Point with coordinates QQFieldElem[0, 0] -julia> Q = Oscar.Point([QQ(2), QQ(-2)]) +julia> Q = Point([QQ(2), QQ(-2)]) Point with coordinates QQFieldElem[2, -2] -julia> Oscar.aretransverse(C, D, P) +julia> aretransverse(C, D, P) false -julia> Oscar.aretransverse(C, D, Q) +julia> aretransverse(C, D, Q) true ``` """ @@ -494,10 +494,10 @@ Return `true` if `C` has no singular point, and `false` otherwise. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(x*(x+y)) +julia> C = AffinePlaneCurve(x*(x+y)) Affine plane curve defined by x^2 + x*y -julia> Oscar.is_smooth_curve(C) +julia> is_smooth_curve(C) false ``` """ @@ -539,10 +539,10 @@ Return the geometric genus of the projective closure of `C`. julia> R, (x, y) = polynomial_ring(GF(7), ["x", "y"]) (Multivariate polynomial ring in 2 variables over GF(7), fpMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^9 - x^2*(x-1)^9) +julia> C = AffinePlaneCurve(y^9 - x^2*(x-1)^9) Affine plane curve defined by 6*x^11 + 2*x^10 + 6*x^9 + x^4 + 5*x^3 + x^2 + y^9 -julia> Oscar.geometric_genus(C) +julia> geometric_genus(C) 0 ``` """ diff --git a/experimental/PlaneCurve/src/DivisorCurve.jl b/experimental/PlaneCurve/src/DivisorCurve.jl index b576ee6dbbae..1e64b631459e 100644 --- a/experimental/PlaneCurve/src/DivisorCurve.jl +++ b/experimental/PlaneCurve/src/DivisorCurve.jl @@ -31,13 +31,13 @@ Given a curve `C` which is assumed to be smooth and irreducible, return the divi julia> R, (x,y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^2 + y + x^2) +julia> C = AffinePlaneCurve(y^2 + y + x^2) Affine plane curve defined by x^2 + y^2 + y -julia> P = Oscar.Point([QQ(0), QQ(0)]) +julia> P = Point([QQ(0), QQ(0)]) Point with coordinates QQFieldElem[0, 0] -julia> Q = Oscar.Point([QQ(0), QQ(-1)]) +julia> Q = Point([QQ(0), QQ(-1)]) Point with coordinates QQFieldElem[0, -1] julia> Oscar.AffineCurveDivisor(C, Dict(P => 3, Q => -2)) @@ -86,7 +86,7 @@ julia> S, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(T(y^2 + y*z + x^2)) +julia> C = ProjPlaneCurve(T(y^2 + y*z + x^2)) Projective plane curve defined by x^2 + y^2 + y*z julia> PP = proj_space(QQ, 2) @@ -261,13 +261,13 @@ Return `true` if `D` is an effective divisor, `false` otherwise. julia> R, (x,y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^2 + y + x^2) +julia> C = AffinePlaneCurve(y^2 + y + x^2) Affine plane curve defined by x^2 + y^2 + y -julia> P = Oscar.Point([QQ(0), QQ(0)]) +julia> P = Point([QQ(0), QQ(0)]) Point with coordinates QQFieldElem[0, 0] -julia> Q = Oscar.Point([QQ(0), QQ(-1)]) +julia> Q = Point([QQ(0), QQ(-1)]) Point with coordinates QQFieldElem[0, -1] julia> D = Oscar.AffineCurveDivisor(C, Dict(P => 3, Q => -2)) @@ -304,7 +304,7 @@ julia> S, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(T(y^2 + y*z + x^2)) +julia> C = ProjPlaneCurve(T(y^2 + y*z + x^2)) Projective plane curve defined by x^2 + y^2 + y*z julia> PP = proj_space(QQ, 2) @@ -317,18 +317,18 @@ julia> P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(0), QQ(1)]) julia> phi = T(x)//T(y) x//y -julia> Oscar.multiplicity(C, phi, P) +julia> multiplicity(C, phi, P) -1 ``` """ -function multiplicity(C::AffinePlaneCurve{S}, phi::AbstractAlgebra.Generic.Frac{T}, P::Point{S}) where {S <: FieldElem, T <: MPolyRingElem{S}} +function Oscar.multiplicity(C::AffinePlaneCurve{S}, phi::AbstractAlgebra.Generic.Frac{T}, P::Point{S}) where {S <: FieldElem, T <: MPolyRingElem{S}} f = divrem(phi.num, C.eq) g = divrem(phi.den, C.eq) !iszero(g[2]) || error("This is not a rational function on `C`") return multiplicity(C, f[2], P) - multiplicity(C, g[2], P) end -function multiplicity(C::ProjPlaneCurve{S}, phi::AbstractAlgebra.Generic.Frac{T}, P::Oscar.Geometry.ProjSpcElem{S}) where {S <: FieldElem, T <: Oscar.MPolyDecRingElem{S}} +function Oscar.multiplicity(C::ProjPlaneCurve{S}, phi::AbstractAlgebra.Generic.Frac{T}, P::Oscar.Geometry.ProjSpcElem{S}) where {S <: FieldElem, T <: Oscar.MPolyDecRingElem{S}} g = divrem(phi.den.f, C.eq.f) !iszero(g[2]) || error("This is not a rational function on the curve") f = divrem(phi.num.f, C.eq.f) @@ -345,7 +345,7 @@ end Return the multiplicity of the polynomial `F` on the curve `C` at the point `P`. """ -function multiplicity(C::AffinePlaneCurve{S}, F::Oscar.MPolyRingElem{S}, P::Point{S}) where S <: FieldElem +function Oscar.multiplicity(C::AffinePlaneCurve{S}, F::Oscar.MPolyRingElem{S}, P::Point{S}) where S <: FieldElem f = divrem(F, C.eq) if iszero(f[2]) return Inf @@ -356,7 +356,7 @@ function multiplicity(C::AffinePlaneCurve{S}, F::Oscar.MPolyRingElem{S}, P::Poin end end -function multiplicity(C::ProjPlaneCurve{S}, F::Oscar.MPolyDecRingElem{S}, P::Oscar.Geometry.ProjSpcElem{S}) where S <: FieldElem +function Oscar.multiplicity(C::ProjPlaneCurve{S}, F::Oscar.MPolyDecRingElem{S}, P::Oscar.Geometry.ProjSpcElem{S}) where S <: FieldElem f = divrem(F.f, defining_equation(C)) if iszero(f[2]) return Inf @@ -448,7 +448,7 @@ julia> S, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(T(y^2 + y*z + x^2)) +julia> C = ProjPlaneCurve(T(y^2 + y*z + x^2)) Projective plane curve defined by x^2 + y^2 + y*z julia> PP = proj_space(QQ, 2) @@ -593,7 +593,7 @@ julia> S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(T(y^2*z - x*(x-z)*(x+3*z))) +julia> C = ProjPlaneCurve(T(y^2*z - x*(x-z)*(x+3*z))) Projective plane curve defined by -x^3 - 2*x^2*z + 3*x*z^2 + y^2*z julia> PP = proj_space(QQ, 2) @@ -689,7 +689,7 @@ julia> S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(T(y^2*z - x*(x-z)*(x+3*z))) +julia> C = ProjPlaneCurve(T(y^2*z - x*(x-z)*(x+3*z))) Projective plane curve defined by -x^3 - 2*x^2*z + 3*x*z^2 + y^2*z julia> PP = proj_space(QQ, 2) @@ -730,7 +730,7 @@ julia> S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(T(y^2*z - x*(x-z)*(x+3*z))) +julia> C = ProjPlaneCurve(T(y^2*z - x*(x-z)*(x+3*z))) Projective plane curve defined by -x^3 - 2*x^2*z + 3*x*z^2 + y^2*z julia> PP = proj_space(QQ, 2) @@ -769,7 +769,7 @@ julia> S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(T(y^2*z - x*(x-z)*(x+3*z))) +julia> C = ProjPlaneCurve(T(y^2*z - x*(x-z)*(x+3*z))) Projective plane curve defined by -x^3 - 2*x^2*z + 3*x*z^2 + y^2*z julia> PP = proj_space(QQ, 2) diff --git a/experimental/PlaneCurve/src/PlaneCurve.jl b/experimental/PlaneCurve/src/PlaneCurve.jl index ad0467ee532b..0285b78c8024 100644 --- a/experimental/PlaneCurve/src/PlaneCurve.jl +++ b/experimental/PlaneCurve/src/PlaneCurve.jl @@ -36,7 +36,7 @@ Return the point with the given coordinates. # Examples ```jldoctest -julia> P = Oscar.Point([QQ(1), QQ(2), QQ(2)]) +julia> P = Point([QQ(1), QQ(2), QQ(2)]) Point with coordinates QQFieldElem[1, 2, 2] ``` """ @@ -81,7 +81,7 @@ Return the maximal ideal associated to the point `P` in the ring `R`. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> P = Oscar.Point([QQ(2), QQ(1)]) +julia> P = Point([QQ(2), QQ(1)]) Point with coordinates QQFieldElem[2, 1] julia> Oscar.ideal_point(R, P) @@ -109,7 +109,7 @@ julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) julia> F = y^3*x^6 - y^6*x^2 x^6*y^3 - x^2*y^6 -julia> C = Oscar.AffinePlaneCurve(F) +julia> C = AffinePlaneCurve(F) Affine plane curve defined by x^6*y^3 - x^2*y^6 ``` """ @@ -153,7 +153,7 @@ julia> T, _ = grade(R) julia> F = T(y^3*x^6 - y^6*x^2*z) x^6*y^3 - x^2*y^6*z -julia> Oscar.ProjPlaneCurve(F) +julia> ProjPlaneCurve(F) Projective plane curve defined by x^6*y^3 - x^2*y^6*z ``` """ @@ -276,7 +276,7 @@ Return the Jacobian ideal of the defining polynomial of `C`. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^3*x^6 - y^6*x^2) +julia> C = AffinePlaneCurve(y^3*x^6 - y^6*x^2) Affine plane curve defined by x^6*y^3 - x^2*y^6 julia> Oscar.jacobi_ideal(C) @@ -300,7 +300,7 @@ Return a dictionary containing the irreducible components of `C` and their multi julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^3*x^6 - y^6*x^2) +julia> C = AffinePlaneCurve(y^3*x^6 - y^6*x^2) Affine plane curve defined by x^6*y^3 - x^2*y^6 julia> Oscar.curve_components(C) @@ -332,13 +332,13 @@ Return `true` if `C` is irreducible, and `false` otherwise. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^2+x-x^3) +julia> C = AffinePlaneCurve(y^2+x-x^3) Affine plane curve defined by -x^3 + x + y^2 julia> Oscar.is_irreducible(C) true -julia> D = Oscar.AffinePlaneCurve(y^3*x^6 - y^6*x^2) +julia> D = AffinePlaneCurve(y^3*x^6 - y^6*x^2) Affine plane curve defined by x^6*y^3 - x^2*y^6 julia> Oscar.is_irreducible(D) @@ -362,13 +362,13 @@ Return `true` if `C` is reduced, and `false` otherwise. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^2+x-x^3) +julia> C = AffinePlaneCurve(y^2+x-x^3) Affine plane curve defined by -x^3 + x + y^2 julia> Oscar.is_reduced(C) true -julia> D = Oscar.AffinePlaneCurve(y^3*x^6 - y^6*x^2) +julia> D = AffinePlaneCurve(y^3*x^6 - y^6*x^2) Affine plane curve defined by x^6*y^3 - x^2*y^6 julia> Oscar.is_reduced(D) @@ -398,7 +398,7 @@ Return the plane curve defined by the squarefree part of the equation of `C`. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^3*x^6 - y^6*x^2) +julia> C = AffinePlaneCurve(y^3*x^6 - y^6*x^2) Affine plane curve defined by x^6*y^3 - x^2*y^6 julia> Oscar.reduction(C) @@ -440,10 +440,10 @@ Return the union of `C` and `D` (with multiplicity). julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^2+x-x^3) +julia> C = AffinePlaneCurve(y^2+x-x^3) Affine plane curve defined by -x^3 + x + y^2 -julia> D = Oscar.AffinePlaneCurve(y^3*x^6 - y^6*x^2) +julia> D = AffinePlaneCurve(y^3*x^6 - y^6*x^2) Affine plane curve defined by x^6*y^3 - x^2*y^6 julia> union(C, D) @@ -465,7 +465,7 @@ Return the coordinate ring of the curve `C`. julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) -julia> C = Oscar.AffinePlaneCurve(y^2+x-x^3) +julia> C = AffinePlaneCurve(y^2+x-x^3) Affine plane curve defined by -x^3 + x + y^2 julia> Oscar.ring(C) diff --git a/experimental/PlaneCurve/src/ProjEllipticCurve.jl b/experimental/PlaneCurve/src/ProjEllipticCurve.jl index f984d46f922d..7c36297756cf 100644 --- a/experimental/PlaneCurve/src/ProjEllipticCurve.jl +++ b/experimental/PlaneCurve/src/ProjEllipticCurve.jl @@ -568,7 +568,7 @@ julia> PP = proj_space(QQ, 2) julia> Q = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(-1), QQ(1), QQ(0)]) (-1 : 1 : 0) -julia> D = Oscar.ProjPlaneCurve(T(-x^3 - 3*x^2*y + 2*x^2*z - 3*x*y^2 + 3*x*y*z - 4*x*z^2 - y^3 - y*z^2 + 6*z^3)) +julia> D = ProjPlaneCurve(T(-x^3 - 3*x^2*y + 2*x^2*z - 3*x*y^2 + 3*x*y*z - 4*x*z^2 - y^3 - y*z^2 + 6*z^3)) Projective plane curve defined by -x^3 - 3*x^2*y + 2*x^2*z - 3*x*y^2 + 3*x*y*z - 4*x*z^2 - y^3 - y*z^2 + 6*z^3 julia> Oscar.toweierstrass(D, Q) diff --git a/experimental/PlaneCurve/src/ProjPlaneCurve.jl b/experimental/PlaneCurve/src/ProjPlaneCurve.jl index 5dad2e0cdf5d..03f06c7765ea 100644 --- a/experimental/PlaneCurve/src/ProjPlaneCurve.jl +++ b/experimental/PlaneCurve/src/ProjPlaneCurve.jl @@ -34,7 +34,7 @@ julia> S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(x^2*(x+y)*(y^3-x^2*z)) +julia> C = ProjPlaneCurve(x^2*(x+y)*(y^3-x^2*z)) Projective plane curve defined by -x^5*z - x^4*y*z + x^3*y^3 + x^2*y^4 julia> PP = proj_space(QQ, 2) @@ -44,7 +44,7 @@ julia> PP = proj_space(QQ, 2) julia> P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(0), QQ(1)]) (0 : 0 : 1) -julia> Oscar.is_smooth(C, P) +julia> is_smooth(C, P) false ``` """ @@ -80,13 +80,13 @@ julia> PP = proj_space(QQ, 2) (Projective space of dim 2 over Rational field , MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[0], x[1], x[2]]) -julia> C = Oscar.ProjPlaneCurve(x^2*(x+y)*(y^3-x^2*z)) +julia> C = ProjPlaneCurve(x^2*(x+y)*(y^3-x^2*z)) Projective plane curve defined by -x^5*z - x^4*y*z + x^3*y^3 + x^2*y^4 julia> P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(2), QQ(-2), QQ(1)]) (2 : -2 : 1) -julia> Oscar.tangent(C, P) +julia> tangent(C, P) Projective plane curve defined by -48*x - 48*y ``` """ @@ -158,13 +158,13 @@ julia> PP = proj_space(QQ, 2) (Projective space of dim 2 over Rational field , MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[0], x[1], x[2]]) -julia> C = Oscar.ProjPlaneCurve(T(x+y+z)) +julia> C = ProjPlaneCurve(T(x+y+z)) Projective plane curve defined by x + y + z -julia> D = Oscar.ProjPlaneCurve(T(z)) +julia> D = ProjPlaneCurve(T(z)) Projective plane curve defined by z -julia> Oscar.curve_intersect(PP[1], C, D) +julia> curve_intersect(PP[1], C, D) 2-element Vector{Vector{Any}}: [] [(-1 : 1 : 0)] @@ -328,7 +328,7 @@ end Return the multiplicity of `C` at `P`. """ -function multiplicity(C::ProjectivePlaneCurve{S}, P::Oscar.Geometry.ProjSpcElem{S}) where S <: FieldElem +function Oscar.multiplicity(C::ProjectivePlaneCurve{S}, P::Oscar.Geometry.ProjSpcElem{S}) where S <: FieldElem if P.v[3] != 0 Fa = dehomogenization(C.eq, 3) Ca = AffinePlaneCurve(Fa) @@ -457,7 +457,7 @@ julia> S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) julia> T, _ = grade(S) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) -julia> C = Oscar.ProjPlaneCurve(T(y^2 * z - x^3 - x * z^2)) +julia> C = ProjPlaneCurve(T(y^2 * z - x^3 - x * z^2)) Projective plane curve defined by -x^3 - x*z^2 + y^2*z julia> Oscar.PlaneCurveModule.arithmetic_genus(C) diff --git a/experimental/PlaneCurve/test/runtests.jl b/experimental/PlaneCurve/test/runtests.jl index d724da263f12..6d71638f3ec9 100644 --- a/experimental/PlaneCurve/test/runtests.jl +++ b/experimental/PlaneCurve/test/runtests.jl @@ -3,167 +3,167 @@ @testset "AffinePlaneCurve constructors" begin R, (x, y) = polynomial_ring(QQ, ["x", "y"]) F = y^3 * x^6 - y^6 * x^2 - C = Oscar.AffinePlaneCurve(F) + C = AffinePlaneCurve(F) @test Oscar.defining_equation(C) == F @test dim(C) == 1 @test degree(C) == 9 - @test Oscar.curve_components(C) == Dict{Oscar.AffinePlaneCurve{QQFieldElem},Int64}( - Oscar.AffinePlaneCurve(x) => 2, - Oscar.AffinePlaneCurve(y) => 3, - Oscar.AffinePlaneCurve(x^4 - y^3) => 1, + @test Oscar.curve_components(C) == Dict{AffinePlaneCurve{QQFieldElem},Int64}( + AffinePlaneCurve(x) => 2, + AffinePlaneCurve(y) => 3, + AffinePlaneCurve(x^4 - y^3) => 1, ) - @test C == Oscar.AffinePlaneCurve(2 * F) + @test C == AffinePlaneCurve(2 * F) end @testset "AffinePlaneCurve reducible functions" begin R, (x, y) = polynomial_ring(QQ, ["x", "y"]) - F = Oscar.AffinePlaneCurve((x^2 + y^2)) - P = Oscar.Point([QQ(0), QQ(0)]) + F = AffinePlaneCurve((x^2 + y^2)) + P = Point([QQ(0), QQ(0)]) @test Oscar.is_irreducible(F) @test Oscar.is_reduced(F) @test Oscar.reduction(F) == F - G = Oscar.AffinePlaneCurve(y^2) + G = AffinePlaneCurve(y^2) @test !Oscar.is_irreducible(G) @test !Oscar.is_reduced(G) - @test Oscar.reduction(G) == Oscar.AffinePlaneCurve(y) + @test Oscar.reduction(G) == AffinePlaneCurve(y) - H = Oscar.AffinePlaneCurve(x * y) + H = AffinePlaneCurve(x * y) @test !Oscar.is_irreducible(H) @test Oscar.is_reduced(H) @test Oscar.reduction(H) == H - @test Oscar.union(G, H) == Oscar.AffinePlaneCurve(x * y^3) + @test Oscar.union(G, H) == AffinePlaneCurve(x * y^3) end @testset "AffinePlaneCurve intersection functions" begin R, (x, y) = polynomial_ring(QQ, ["x", "y"]) - F = Oscar.AffinePlaneCurve(x * (x + y)) - G = Oscar.AffinePlaneCurve(x + y^2 + 1) - H = Oscar.AffinePlaneCurve(x * (x + y) * y) - M = Oscar.AffinePlaneCurve((x - y) * (x - 2)) + F = AffinePlaneCurve(x * (x + y)) + G = AffinePlaneCurve(x + y^2 + 1) + H = AffinePlaneCurve(x * (x + y) * y) + M = AffinePlaneCurve((x - y) * (x - 2)) - P = Oscar.Point([QQ(0), QQ(0)]) - Q = Oscar.Point([QQ(2), QQ(-2)]) + P = Point([QQ(0), QQ(0)]) + Q = Point([QQ(2), QQ(-2)]) - @test Oscar.common_components(F, G) == [] - @test Oscar.common_components(F, H) == [Oscar.AffinePlaneCurve(x * (x + y))] + @test common_components(F, G) == [] + @test common_components(F, H) == [AffinePlaneCurve(x * (x + y))] - @test Oscar.curve_intersect(F, G) == [[], []] - @test Oscar.curve_intersect(F, H) == [[Oscar.AffinePlaneCurve(x * (x + y))], []] - @test Oscar.curve_intersect(F, M) == [[], [P, Q]] || - Oscar.curve_intersect(F, M) == [[], [Q, P]] + @test curve_intersect(F, G) == [[], []] + @test curve_intersect(F, H) == [[AffinePlaneCurve(x * (x + y))], []] + @test curve_intersect(F, M) == [[], [P, Q]] || + curve_intersect(F, M) == [[], [Q, P]] - @test !Oscar.aretransverse(F, H, P) - @test !Oscar.aretransverse(F, G, P) - @test Oscar.aretransverse(F, M, Q) + @test !aretransverse(F, H, P) + @test !aretransverse(F, G, P) + @test aretransverse(F, M, Q) end @testset "AffinePlaneCurve int_multiplicity functions" begin R, (x, y) = polynomial_ring(QQ, ["x", "y"]) - F = Oscar.AffinePlaneCurve((x^2 + y^2) * (x^2 + y^2 + 2 * y)) - G = Oscar.AffinePlaneCurve((x^2 + y^2) * (y^3 * x^6 - y^6 * x^2)) - L = Oscar.curve_intersect(F, G) - P = Oscar.Point([QQ(0), QQ(0)]) - Q = Oscar.Point([QQ(0), QQ(-2)]) - - @test L == [[Oscar.AffinePlaneCurve(x^2 + y^2)], [P, Q]] || - L == [[Oscar.AffinePlaneCurve(x^2 + y^2)], [Q, P]] - @test Oscar.intersection_multiplicity(F, G, Q) == 2 - @test Oscar.intersection_multiplicity(F, G, P) == -1 + F = AffinePlaneCurve((x^2 + y^2) * (x^2 + y^2 + 2 * y)) + G = AffinePlaneCurve((x^2 + y^2) * (y^3 * x^6 - y^6 * x^2)) + L = curve_intersect(F, G) + P = Point([QQ(0), QQ(0)]) + Q = Point([QQ(0), QQ(-2)]) + + @test L == [[AffinePlaneCurve(x^2 + y^2)], [P, Q]] || + L == [[AffinePlaneCurve(x^2 + y^2)], [Q, P]] + @test intersection_multiplicity(F, G, Q) == 2 + @test intersection_multiplicity(F, G, P) == -1 end @testset "AffinePlaneCurve singularity functions" begin R, (x, y) = polynomial_ring(QQ, ["x", "y"]) - F = Oscar.AffinePlaneCurve(x + y^2) + F = AffinePlaneCurve(x + y^2) - @test Oscar.curve_singular_locus(F) == [[], []] - @test Oscar.is_smooth_curve(F) + @test curve_singular_locus(F) == [[], []] + @test is_smooth_curve(F) - H = Oscar.AffinePlaneCurve(x * y * (x + y)) - @test !Oscar.is_smooth_curve(H) + H = AffinePlaneCurve(x * y * (x + y)) + @test !is_smooth_curve(H) - G = Oscar.AffinePlaneCurve(x^2 * (x + y) * (y^3 - x^2)) - S = Oscar.curve_singular_locus(G) - P1 = Oscar.Point([QQ(0), QQ(0)]) - P2 = Oscar.Point([QQ(-1), QQ(1)]) - P3 = Oscar.Point([QQ(2), QQ(-2)]) - P4 = Oscar.Point([QQ(1), QQ(2)]) + G = AffinePlaneCurve(x^2 * (x + y) * (y^3 - x^2)) + S = curve_singular_locus(G) + P1 = Point([QQ(0), QQ(0)]) + P2 = Point([QQ(-1), QQ(1)]) + P3 = Point([QQ(2), QQ(-2)]) + P4 = Point([QQ(1), QQ(2)]) - @test S == [[Oscar.AffinePlaneCurve(x)], [P1, P2]] || - S == [[Oscar.AffinePlaneCurve(x)], [P2, P1]] - @test !Oscar.is_smooth(G, P1) - @test Oscar.is_smooth(G, P3) + @test S == [[AffinePlaneCurve(x)], [P1, P2]] || + S == [[AffinePlaneCurve(x)], [P2, P1]] + @test !is_smooth(G, P1) + @test is_smooth(G, P3) - @test Oscar.tangent(G, P3) == Oscar.AffinePlaneCurve(x + y) - @test Oscar.tangent_lines(G, P1) == Dict{Oscar.AffinePlaneCurve{QQFieldElem},Int64}( - Oscar.AffinePlaneCurve(x) => 4, - Oscar.AffinePlaneCurve(x + y) => 1, + @test tangent(G, P3) == AffinePlaneCurve(x + y) + @test tangent_lines(G, P1) == Dict{AffinePlaneCurve{QQFieldElem},Int64}( + AffinePlaneCurve(x) => 4, + AffinePlaneCurve(x + y) => 1, ) - @test Oscar.multiplicity(G, P1) == 5 - @test Oscar.multiplicity(G, P3) == 1 - @test Oscar.multiplicity(G, P4) == 0 + @test multiplicity(G, P1) == 5 + @test multiplicity(G, P3) == 1 + @test multiplicity(G, P4) == 0 end @testset "ProjPlaneCurve constructors" begin R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(R) F = T(y^3 * x^6 - y^6 * x^2 * z) - C = Oscar.ProjPlaneCurve(F) + C = ProjPlaneCurve(F) @test Oscar.defining_equation(C) == F.f @test dim(C) == 1 @test degree(C) == 9 - @test Oscar.curve_components(C) == Dict{Oscar.ProjPlaneCurve{QQFieldElem},Int64}( - Oscar.ProjPlaneCurve(T(x)) => 2, - Oscar.ProjPlaneCurve(T(y)) => 3, - Oscar.ProjPlaneCurve(T(x^4 - y^3 * z)) => 1, + @test Oscar.curve_components(C) == Dict{ProjPlaneCurve{QQFieldElem},Int64}( + ProjPlaneCurve(T(x)) => 2, + ProjPlaneCurve(T(y)) => 3, + ProjPlaneCurve(T(x^4 - y^3 * z)) => 1, ) - @test C == Oscar.ProjPlaneCurve(2 * F) + @test C == ProjPlaneCurve(2 * F) end @testset "ProjPlaneCurve reducible functions" begin R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(R) - F = Oscar.ProjPlaneCurve(T(x^2 + y^2)) - P = Oscar.Point([QQ(0), QQ(0), QQ(1)]) + F = ProjPlaneCurve(T(x^2 + y^2)) + P = Point([QQ(0), QQ(0), QQ(1)]) @test Oscar.is_irreducible(F) @test Oscar.is_reduced(F) @test Oscar.reduction(F) == F - G = Oscar.ProjPlaneCurve(T(y^2)) + G = ProjPlaneCurve(T(y^2)) @test !Oscar.is_irreducible(G) @test !Oscar.is_reduced(G) - @test Oscar.reduction(G) == Oscar.ProjPlaneCurve(T(y)) + @test Oscar.reduction(G) == ProjPlaneCurve(T(y)) - H = Oscar.ProjPlaneCurve(T(x * y)) + H = ProjPlaneCurve(T(x * y)) @test !Oscar.is_irreducible(H) @test Oscar.is_reduced(H) @test Oscar.reduction(H) == H - @test Oscar.union(G, H) == Oscar.ProjPlaneCurve(T(x * y^3)) + @test Oscar.union(G, H) == ProjPlaneCurve(T(x * y^3)) end @testset "ProjPlaneCurve intersection functions" begin R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(R) - F = Oscar.ProjPlaneCurve(T(x * (x + y))) - G = Oscar.ProjPlaneCurve(T(x * z + y^2 + z^2)) - H = Oscar.ProjPlaneCurve(T(x * (x + y) * y)) - M = Oscar.ProjPlaneCurve((x - y) * (x - 2 * z)) + F = ProjPlaneCurve(T(x * (x + y))) + G = ProjPlaneCurve(T(x * z + y^2 + z^2)) + H = ProjPlaneCurve(T(x * (x + y) * y)) + M = ProjPlaneCurve((x - y) * (x - 2 * z)) PP = proj_space(QQ, 2) P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(0), QQ(1)]) @@ -171,18 +171,18 @@ end S = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(1), QQ(0)]) Z = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(1), QQ(-1), QQ(0)]) - @test Oscar.common_components(F, G) == [] - @test Oscar.common_components(F, H) == [Oscar.ProjPlaneCurve(T(x * (x + y)))] + @test common_components(F, G) == [] + @test common_components(F, H) == [ProjPlaneCurve(T(x * (x + y)))] - @test Oscar.curve_intersect(PP[1], F, G) == [[], []] - @test Oscar.curve_intersect(PP[1], F, H) == [[Oscar.ProjPlaneCurve(T(x * (x + y)))], []] - @test Oscar.curve_intersect( + @test curve_intersect(PP[1], F, G) == [[], []] + @test curve_intersect(PP[1], F, H) == [[ProjPlaneCurve(T(x * (x + y)))], []] + @test curve_intersect( PP[1], - Oscar.ProjPlaneCurve(T(x + y + z)), - Oscar.ProjPlaneCurve(T(z)), + ProjPlaneCurve(T(x + y + z)), + ProjPlaneCurve(T(z)), ) == [[], [Z]] - L = Oscar.curve_intersect(PP[1], F, M) + L = curve_intersect(PP[1], F, M) @test L[1] == [] @test length(L[2]) == 3 @@ -190,89 +190,89 @@ end @test length(findall(x -> x == Q, L[2])) == 1 @test length(findall(x -> x == S, L[2])) == 1 - @test !Oscar.aretransverse(F, H, P) - @test !Oscar.aretransverse(F, G, P) - @test Oscar.aretransverse(F, M, Q) + @test !aretransverse(F, H, P) + @test !aretransverse(F, G, P) + @test aretransverse(F, M, Q) end @testset "ProjPlaneCurve int_multiplicity functions" begin R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(R) - F = Oscar.ProjPlaneCurve(T((x^2 + y^2) * (x^2 + y^2 + 2 * y * z))) - G = Oscar.ProjPlaneCurve(T((x^2 + y^2) * (y^3 * x^6 - y^6 * x^2 * z))) + F = ProjPlaneCurve(T((x^2 + y^2) * (x^2 + y^2 + 2 * y * z))) + G = ProjPlaneCurve(T((x^2 + y^2) * (y^3 * x^6 - y^6 * x^2 * z))) PP = proj_space(QQ, 2) - L = Oscar.curve_intersect(PP[1], F, G) + L = curve_intersect(PP[1], F, G) P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(0), QQ(1)]) Q = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(-2), QQ(1)]) - @test L[1] == [Oscar.ProjPlaneCurve(T(x^2 + y^2))] + @test L[1] == [ProjPlaneCurve(T(x^2 + y^2))] @test length(L[2]) == 2 @test length(findall(x -> x == P, L[2])) == 1 @test length(findall(x -> x == Q, L[2])) == 1 - @test Oscar.intersection_multiplicity(F, G, Q) == 2 - @test Oscar.intersection_multiplicity(F, G, P) == -1 + @test intersection_multiplicity(F, G, Q) == 2 + @test intersection_multiplicity(F, G, P) == -1 end @testset "ProjPlaneCurve singularity functions" begin R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(R) PP = proj_space(QQ, 2) - F = Oscar.ProjPlaneCurve(T(x * z + y^2)) + F = ProjPlaneCurve(T(x * z + y^2)) P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(1), QQ(0), QQ(0)]) - @test Oscar.curve_singular_locus(F) == [[], []] - @test Oscar.is_smooth_curve(F) - @test Oscar.multiplicity(F, P) == 1 + @test curve_singular_locus(F) == [[], []] + @test is_smooth_curve(F) + @test multiplicity(F, P) == 1 - H = Oscar.ProjPlaneCurve(T(x * y * (x + y))) - @test !Oscar.is_smooth_curve(H) + H = ProjPlaneCurve(T(x * y * (x + y))) + @test !is_smooth_curve(H) - G = Oscar.ProjPlaneCurve(x^2 * (x + y) * (y^3 - x^2 * z)) - S = Oscar.curve_singular_locus(G) + G = ProjPlaneCurve(x^2 * (x + y) * (y^3 - x^2 * z)) + S = curve_singular_locus(G) P1 = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(0), QQ(1)]) P2 = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(-1), QQ(1), QQ(1)]) P3 = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(2), QQ(-2), QQ(1)]) P4 = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(1), QQ(2), QQ(1)]) - @test S[1] == [Oscar.ProjPlaneCurve(T(x))] + @test S[1] == [ProjPlaneCurve(T(x))] @test length(S[2]) == 2 @test length(findall(x -> x == P1, S[2])) == 1 @test length(findall(x -> x == P2, S[2])) == 1 - @test !Oscar.is_smooth(G, P1) - @test Oscar.is_smooth(G, P3) + @test !is_smooth(G, P1) + @test is_smooth(G, P3) - @test Oscar.tangent(G, P3) == Oscar.ProjPlaneCurve(T(x + y)) - @test Oscar.tangent_lines(G, P1) == Dict{Oscar.ProjPlaneCurve{QQFieldElem},Int64}( - Oscar.ProjPlaneCurve(T(x)) => 4, - Oscar.ProjPlaneCurve(T(x + y)) => 1, + @test tangent(G, P3) == ProjPlaneCurve(T(x + y)) + @test tangent_lines(G, P1) == Dict{ProjPlaneCurve{QQFieldElem},Int64}( + ProjPlaneCurve(T(x)) => 4, + ProjPlaneCurve(T(x + y)) => 1, ) - @test Oscar.multiplicity(G, P1) == 5 - @test Oscar.multiplicity(G, P3) == 1 - @test Oscar.multiplicity(G, P4) == 0 + @test multiplicity(G, P1) == 5 + @test multiplicity(G, P3) == 1 + @test multiplicity(G, P4) == 0 end @testset "AffineCurveDivisor basic functions" begin R, (x, y) = polynomial_ring(QQ, ["x", "y"]) - C = Oscar.AffinePlaneCurve(y^2 + y + x^2) - P = Oscar.Point([QQ(0), QQ(0)]) - Q = Oscar.Point([QQ(0), QQ(-1)]) + C = AffinePlaneCurve(y^2 + y + x^2) + P = Point([QQ(0), QQ(0)]) + Q = Point([QQ(0), QQ(-1)]) D = Oscar.AffineCurveDivisor(C, Dict(P => 3, Q => -2)) @test Oscar.AffineCurveDivisor(C, P, -3) + D == Oscar.AffineCurveDivisor(C, Q, -2) @test -2 * D == Oscar.AffineCurveDivisor(C, Dict(P => -6, Q => 4)) @test !Oscar.is_effective(D) @test Oscar.is_effective(Oscar.AffineCurveDivisor(C, P, 3)) phi = y // x - @test Oscar.multiplicity(C, phi, P) == 1 + @test multiplicity(C, phi, P) == 1 @test Oscar.divisor(C, phi) == Oscar.AffineCurveDivisor(C, Dict(P => 1, Q => -1)) end @testset "ProjCurveDivisor basic functions" begin S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(S) - C = Oscar.ProjPlaneCurve(T(y^2 + y * z + x^2)) + C = ProjPlaneCurve(T(y^2 + y * z + x^2)) PP = proj_space(QQ, 2) P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(0), QQ(1)]) Q = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(-1), QQ(1)]) @@ -283,8 +283,8 @@ end @test Oscar.is_effective(Oscar.ProjCurveDivisor(C, P, 3)) F = T(x) phi = T(x) // T(y) - @test Oscar.multiplicity(C, F, P) == 1 - @test Oscar.multiplicity(C, phi, P) == -1 + @test multiplicity(C, F, P) == 1 + @test multiplicity(C, phi, P) == -1 @test Oscar.divisor(PP[1], C, F) == Oscar.ProjCurveDivisor(C, Dict(P => 1, Q => 1)) @test Oscar.divisor(PP[1], C, phi) == Oscar.ProjCurveDivisor(C, Dict(P => -1, Q => 1)) end @@ -292,7 +292,7 @@ end @testset "ProjCurveDivisor global sections" begin S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(S) - C = Oscar.ProjPlaneCurve(T(y^2 * z - x * (x - z) * (x + 3 * z))) + C = ProjPlaneCurve(T(y^2 * z - x * (x - z) * (x + 3 * z))) PP = proj_space(QQ, 2) P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(1), QQ(0)]) R = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(0), QQ(1)]) @@ -321,8 +321,8 @@ end PP = proj_space(QQ, 2) P = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(0), QQ(1), QQ(0)]) Q = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(-1), QQ(1), QQ(0)]) - C = Oscar.ProjPlaneCurve(T(y^2 * z - x^3 - x * z^2)) - D = Oscar.ProjPlaneCurve( + C = ProjPlaneCurve(T(y^2 * z - x^3 - x * z^2)) + D = ProjPlaneCurve( T( -x^3 - 3 * x^2 * y + 2 * x^2 * z - 3 * x * y^2 + 3 * x * y * z - 4 * x * z^2 - y^3 - y * z^2 + 6 * z^3, ), @@ -336,13 +336,13 @@ end @testset "genus" begin S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(S) - C = Oscar.ProjPlaneCurve(T(y^2 * z - x^3 - x * z^2)) + C = ProjPlaneCurve(T(y^2 * z - x^3 - x * z^2)) @test (Oscar.PlaneCurveModule.arithmetic_genus(C)) == ZZ(1) - @test (Oscar.geometric_genus(C)) == ZZ(1) + @test (geometric_genus(C)) == ZZ(1) R, (a, b) = polynomial_ring(GF(7), ["a", "b"]) - D = Oscar.AffinePlaneCurve(b^9 - a^2 * (a - 1)^9) + D = AffinePlaneCurve(b^9 - a^2 * (a - 1)^9) @test (Oscar.PlaneCurveModule.arithmetic_genus(D)) == ZZ(45) - @test (Oscar.geometric_genus(D)) == ZZ(0) + @test (geometric_genus(D)) == ZZ(0) end @testset "ProjEllipticCurve" begin @@ -366,8 +366,7 @@ end P2 = Oscar.Geometry.ProjSpcElem(PP[1], [QQ(-2), QQ(2), QQ(1)]) Q2 = Oscar.Point_EllCurve(E, P2) @test Q1 + Q2 == Q2 - @test -Q2 == - Oscar.Point_EllCurve(E, Oscar.Geometry.ProjSpcElem(PP[1], [QQ(2), QQ(-2), QQ(1)])) + @test -Q2 == Oscar.Point_EllCurve(E, Oscar.Geometry.ProjSpcElem(PP[1], [QQ(2), QQ(-2), QQ(1)])) end @testset "Counting Points on Elliptic Curves" begin @@ -426,21 +425,21 @@ end @testset "ParaPlaneCurve" begin S, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) T, _ = grade(S) - C1 = Oscar.ProjPlaneCurve(T(1//2*x^5+x^2*y*z^2+x^3*y*z+1//2*x*y^2*z^2-2*x*y^3*z+y^5)) + C1 = ProjPlaneCurve(T(1//2*x^5+x^2*y*z^2+x^3*y*z+1//2*x*y^2*z^2-2*x*y^3*z+y^5)) I1 = Oscar.parametrization_plane_curve(C1) I2 = Oscar.adjoint_ideal(C1) R1 = parent(I1[1]) s, t = gens(R1) @test I1 == [-4*s^4*t + 2*s^3*t^2, 2*s^2*t^3 - s*t^4, 4*s^5 - t^5] @test gens(I2) == [T(-x*y*z + y^3), T(-x^2*z + x*y^2), T(x^2*y + y^2*z), T(x^3 + x*y*z)] - C2 = Oscar.ProjPlaneCurve(T(y^2 - x*z)) + C2 = ProjPlaneCurve(T(y^2 - x*z)) P = Oscar.rational_point_conic(C2) I3 = Oscar.parametrization_conic(C2) R2 = parent(I3[1]) s1, t1 = gens(R2) @test iszero(evaluate(C2.eq, P)) @test I3 == [s1^2, s1*t1, t1^2] - C3 = Oscar.ProjPlaneCurve(T(y^8-x^3*(z+x)^5)) + C3 = ProjPlaneCurve(T(y^8-x^3*(z+x)^5)) D = Oscar.map_to_rational_normal_curve(C3) I4 = Oscar.rat_normal_curve_anticanonical_map(D) Y = gens(parent(I4[1])) @@ -448,8 +447,8 @@ end C4 = Oscar.rat_normal_curve_It_Proj_Even(D) R3 = parent(C4[2].eq) U = gens(R3) - @test C4[2] == Oscar.ProjPlaneCurve(-U[1]*U[3] + U[2]^2) - C5 = Oscar.ProjPlaneCurve(T(-x^7-10*x^5*y^2-10*x^4*y^3-3*x^3*y^4+8*x^2*y^5+ + @test C4[2] == ProjPlaneCurve(-U[1]*U[3] + U[2]^2) + C5 = ProjPlaneCurve(T(-x^7-10*x^5*y^2-10*x^4*y^3-3*x^3*y^4+8*x^2*y^5+ 7*x*y^6+11*y^7+3*x^6*z+10*x^5*y*z+30*x^4*y^2*z+26*x^3*y^3*z-13*x^2*y^4*z- 29*x*y^5*z-33*y^6*z-3*x^5*z^2-20*x^4*y*z^2-33*x^3*y^2*z^2-8*x^2*y^3*z^2+ 37*x*y^4*z^2+33*y^5*z^2+x^4*z^3+10*x^3*y*z^3+13*x^2*y^2*z^3-15*x*y^3*z^3- @@ -459,7 +458,7 @@ end R4 = parent(I5[1]) V = gens(R4) @test I5 == [121*V[3] + 77*V[4], -11*V[5] - 7*V[6]] - C6 = Oscar.ProjPlaneCurve(T(y^8 - x^3*(z+x)^5)) + C6 = ProjPlaneCurve(T(y^8 - x^3*(z+x)^5)) I = Oscar.adjoint_ideal(C6) BM = Oscar.invert_birational_map(gens(I), C6) R5 = parent(BM["image"][1]) diff --git a/experimental/Schemes/ProjectiveModules.jl b/experimental/Schemes/ProjectiveModules.jl index 7c18c50e8dff..f9637430355a 100644 --- a/experimental/Schemes/ProjectiveModules.jl +++ b/experimental/Schemes/ProjectiveModules.jl @@ -283,7 +283,7 @@ function Localization(A::MPolyQuoRing, f::MPolyQuoRingElem) end return c end - return L, MapFromFunc(func, func_inv, A, L) + return L, MapFromFunc(A, L, func, func_inv) end function Localization(A::MPolyLocRing, f::MPolyLocRingElem) @@ -304,7 +304,7 @@ function Localization(A::MPolyLocRing, f::MPolyLocRingElem) i, o = ppio(denominator(a), d) return A(divexact(numerator(f), i), o, check=false) end - return L, MapFromFunc(func, func_inv, A, L) + return L, MapFromFunc(A, L, func, func_inv) end function Localization(A::MPolyQuoLocRing, f::MPolyQuoLocRingElem) @@ -330,6 +330,6 @@ function Localization(A::MPolyQuoLocRing, f::MPolyQuoLocRingElem) end return A(lift(c), o, check=false) end - return L, MapFromFunc(func, func_inv, A, L) + return L, MapFromFunc(A, L, func, func_inv) end diff --git a/experimental/Schemes/Types.jl b/experimental/Schemes/Types.jl index 8f8d2660b3dc..6df3ee8e23e1 100644 --- a/experimental/Schemes/Types.jl +++ b/experimental/Schemes/Types.jl @@ -334,7 +334,7 @@ identifications given by the glueings in the `default_covering`. V in default_covering(X) || return false ambient_scheme(W) in default_covering(X) || return false if V === ambient_scheme(W) - return MapFromFunc(x->(OW(x)), OV, OW) + return MapFromFunc(OV, OW, x->(OW(x))) else G = default_covering(X)[V, ambient_scheme(W)] f, g = glueing_morphisms(G) @@ -342,7 +342,7 @@ identifications given by the glueings in the `default_covering`. parent(a) === OV || error("element does not belong to the correct ring") return restrict(pullback(g)(OO(domain(f))(a)), W, check=false) end - return MapFromFunc(rho_func, OV, OW) + return MapFromFunc(OV, OW, rho_func) end end @@ -359,7 +359,7 @@ identifications given by the glueings in the `default_covering`. parent(a) === OV || error("element does not belong to the correct ring") return OW(a) end - return MapFromFunc(rho_func, OV, OW) + return MapFromFunc(OV, OW, rho_func) else G = default_covering(X)(ambient_scheme(V), ambient_scheme(W)) f, g = glueing_morphisms(G) @@ -371,7 +371,7 @@ identifications given by the glueings in the `default_covering`. parent(a) === OV || error("element does not belong to the correct ring") return pullback(inc)(pullback(gres)(OO(preV)(a))) end - return MapFromFunc(rho_func2, OV, OW) + return MapFromFunc(OV, OW, rho_func2) end end function restriction_func(F::AbsPreSheaf, V::SpecOpen, W::SpecOpen) @@ -379,7 +379,7 @@ identifications given by the glueings in the `default_covering`. OW = F(W) if ambient_scheme(V) === ambient_scheme(W) inc = inclusion_morphism(W, V, check=false) - return MapFromFunc(pullback(inc), OV, OW) + return MapFromFunc(OV, OW, pullback(inc)) else G = default_covering(X)[ambient_scheme(V), ambient_scheme(W)] f, g = glueing_morphisms(G) @@ -388,8 +388,7 @@ identifications given by the glueings in the `default_covering`. preV = preimage(g, VG, check=false) gres = restrict(g, preV, VG, check=false) inc = inclusion_morphism(W, preV, check=false) - return MapFromFunc(x->(pullback(inc)(pullback(gres)(pullback(inc0)(x)))), - OV, OW) + return MapFromFunc(OV, OW, x->(pullback(inc)(pullback(gres)(pullback(inc0)(x))))) end end diff --git a/experimental/SymmetricIntersections/src/elevators.jl b/experimental/SymmetricIntersections/src/elevators.jl index 10e181d9a674..ec44fcd18a9c 100644 --- a/experimental/SymmetricIntersections/src/elevators.jl +++ b/experimental/SymmetricIntersections/src/elevators.jl @@ -83,7 +83,7 @@ end _iter = 0 while val[1] in LL j = indexin([val[1]], LL)[1] - if !(_lbs[j] <= Hecke.multiplicity(ms, val[1])) || any(i -> lbs[i] > 0, 1:_iter+j-1) + if !(_lbs[j] <= multiplicity(ms, val[1])) || any(i -> lbs[i] > 0, 1:_iter+j-1) LL = LL[j+1:end] _lbs = _lbs[j+1:end] _ubs = _ubs[j+1:end] @@ -91,8 +91,8 @@ end continue end aug = 0 - for k in max(1, _lbs[j]):min(Hecke.multiplicity(ms, val[1]), _ubs[j]) - if k == Hecke.multiplicity(ms, val[1]) + for k in max(1, _lbs[j]):min(multiplicity(ms, val[1]), _ubs[j]) + if k == multiplicity(ms, val[1]) _p = any(i -> lbs[i] > 0, [i for i in _iter+j+1:length(lbs) if L[i] == val[1]]) ? Int(0) : Int(1) else _p = 1 @@ -101,7 +101,7 @@ end val2 = sort(unique(ms2)) for l in val2 idx = filter(m -> LL[m] == l, j+1:length(LL)) - _p *= _iterate_size(_lbs[idx], _ubs[idx], Hecke.multiplicity(ms2, l)) + _p *= _iterate_size(_lbs[idx], _ubs[idx], multiplicity(ms2, l)) end len += _p aug += _p @@ -244,7 +244,7 @@ function _first(EC::ElevCtx, sumtype::Vector{ZZRingElem}) for l in val j = findfirst(j -> fL[j] == l, 1:length(L)) idx = filter(m -> fL[m] == l, 1:length(L)) - sl = _first_homog(lbs[idx], ubs[idx], Hecke.multiplicity(ms, l)) + sl = _first_homog(lbs[idx], ubs[idx], multiplicity(ms, l)) append!(s, [k+j-1 for k in sl]) end return s @@ -299,7 +299,7 @@ function _last(EC::ElevCtx, sumtype::Vector{ZZRingElem}) for l in val j = findfirst(j -> fL[j] == l, 1:length(L)) idx = filter(m -> fL[m] == l, 1:length(L)) - sl = _last_homog(lbs[idx], ubs[idx], Hecke.multiplicity(ms, l)) + sl = _last_homog(lbs[idx], ubs[idx], multiplicity(ms, l)) append!(s, [k+j-1 for k in sl]) end return s diff --git a/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl b/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl index f16fdb0b1165..c89ab72cac9b 100644 --- a/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl +++ b/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl @@ -377,7 +377,7 @@ function _submodules_space_isotypical_as_vs(rep::LinRep{S, T, U}, return sum([v[i]*B[i] for i in 1:length(B)]) end - return MapFromFunc(_basis_parametrisation, V, parent(B[1])) + return MapFromFunc(V, parent(B[1]), _basis_parametrisation) end @doc raw""" diff --git a/src/AlgebraicGeometry/Schemes/SpecOpen/Morphisms/Attributes.jl b/src/AlgebraicGeometry/Schemes/SpecOpen/Morphisms/Attributes.jl index e548ad5e57ec..a5c0f2327395 100644 --- a/src/AlgebraicGeometry/Schemes/SpecOpen/Morphisms/Attributes.jl +++ b/src/AlgebraicGeometry/Schemes/SpecOpen/Morphisms/Attributes.jl @@ -29,7 +29,7 @@ function pullback(f::SpecOpenMor) function my_restr(a::SpecOpenRingElem) return SpecOpenRingElem(OO(V), [OO(V[i])(a[i]) for i in 1:ngens(V)]) end - f.pullback = Hecke.MapFromFunc(my_restr, OO(U), OO(V)) + f.pullback = MapFromFunc(OO(U), OO(V), my_restr) return f.pullback::Hecke.Map{typeof(OO(codomain(f))), typeof(OO(domain(f)))} end @@ -74,7 +74,7 @@ function pullback(f::SpecOpenMor) # check=false) # end end - f.pullback = Hecke.MapFromFunc(mymap, OO(U), OO(V)) + f.pullback = MapFromFunc(OO(U), OO(V), mymap) end return f.pullback::Hecke.Map{typeof(OO(codomain(f))), typeof(OO(domain(f)))} end diff --git a/src/AlgebraicGeometry/Schemes/SpecOpen/Rings/Methods.jl b/src/AlgebraicGeometry/Schemes/SpecOpen/Rings/Methods.jl index b813d18caf92..f29513cf16c9 100644 --- a/src/AlgebraicGeometry/Schemes/SpecOpen/Rings/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/SpecOpen/Rings/Methods.jl @@ -208,7 +208,7 @@ function restriction_map( function mymap(f::SpecOpenRingElem) return f[i] end - return MapFromFunc(mymap, OO(U), OO(X)) + return MapFromFunc(OO(U), OO(X), mymap) end # do the checks @@ -290,7 +290,7 @@ function restriction_map( dk = [dk for (p, q, dk, k) in sep] return OO(X)(sum([a*b for (a, b) in zip(g, c)]), check=false)*OO(X)(1//poh^m, check=false) end - return Hecke.MapFromFunc(mysecondmap, OO(U), OO(X)) + return MapFromFunc(OO(U), OO(X), mysecondmap) end # Automatically find a hypersurface equation h such that X = D(h) in @@ -376,7 +376,7 @@ function restriction_map(X::Spec, U::SpecOpen; check::Bool=true) function mymap(f::MPolyQuoLocRingElem) return SpecOpenRingElem(OO(U), [OO(V)(f) for V in affine_patches(U)]) end - return Hecke.MapFromFunc(mymap, OO(X), OO(U)) + return MapFromFunc(OO(X), OO(U), mymap) end function restriction_map(U::SpecOpen, V::SpecOpen; check::Bool=true) @@ -386,7 +386,7 @@ function restriction_map(U::SpecOpen, V::SpecOpen; check::Bool=true) function mymap(f::SpecOpenRingElem) return f end - return Hecke.MapFromFunc(mymap, OO(U), OO(V)) + return MapFromFunc(OO(U), OO(V), mymap) end if ambient_scheme(U) === ambient_scheme(V) @@ -394,14 +394,14 @@ function restriction_map(U::SpecOpen, V::SpecOpen; check::Bool=true) function mysecondmap(f::SpecOpenRingElem) return SpecOpenRingElem(OO(V), [h(f) for h in g], check=false) end - return Hecke.MapFromFunc(mysecondmap, OO(U), OO(V)) + return MapFromFunc(OO(U), OO(V), mysecondmap) end g = [restriction_map(U, W, check=false) for W in affine_patches(V)] function mythirdmap(f::SpecOpenRingElem) return SpecOpenRingElem(OO(V), [g(f) for g in g], check=false) end - return Hecke.MapFromFunc(mythirdmap, OO(U), OO(V)) + return MapFromFunc(OO(U), OO(V), mythirdmap) end ######################################################################## @@ -430,7 +430,7 @@ function canonical_isomorphism(S::SpecOpenRing, T::SpecOpenRing; check::Bool=tru function myinvmap(b::SpecOpenRingElem) return SpecOpenRingElem(S, [g(b) for g in pb_to_Us], check=false) end - return Hecke.MapFromFunc(mymap, myinvmap, S, T) + return MapFromFunc(S, T, mymap, myinvmap) end # Special override for a case where even ideal membership and ring flattenings diff --git a/src/AlgebraicGeometry/Surfaces/K3Auto.jl b/src/AlgebraicGeometry/Surfaces/K3Auto.jl index 944672d319fe..830744f59a66 100644 --- a/src/AlgebraicGeometry/Surfaces/K3Auto.jl +++ b/src/AlgebraicGeometry/Surfaces/K3Auto.jl @@ -1928,7 +1928,7 @@ function ample_class(S::ZZLat) else rv = (r*gram_matrix(S)*transpose(v))[1,1] p = x^2*vsq + 2*x*rv + rsq - rp = roots(p, CalciumQQBar) + rp = roots(CalciumQQBar, p) a = rp[1] b = rp[2] if a > b diff --git a/src/GAP/iso_gap_oscar.jl b/src/GAP/iso_gap_oscar.jl index dcf81019c919..c40c2250d92e 100644 --- a/src/GAP/iso_gap_oscar.jl +++ b/src/GAP/iso_gap_oscar.jl @@ -46,7 +46,7 @@ function _iso_gap_oscar_residue_ring(RG::GAP.GapObj) finv, f = _iso_oscar_gap_residue_ring_functions(RO, RG) - return MapFromFunc(f, finv, RG, RO) + return MapFromFunc(RG, RO, f, finv) end function _iso_gap_oscar_field_finite(FG::GAP.GapObj) @@ -54,28 +54,28 @@ function _iso_gap_oscar_field_finite(FG::GAP.GapObj) finv, f = _iso_oscar_gap_field_finite_functions(FO, FG) - return MapFromFunc(f, finv, FG, FO) + return MapFromFunc(FG, FO, f, finv) end function _iso_gap_oscar_field_rationals(FG::GAP.GapObj) FO = QQ finv, f = _iso_oscar_gap_field_rationals_functions(FO, FG) - return MapFromFunc(f, finv, FG, FO) + return MapFromFunc(FG, FO, f, finv) end function _iso_gap_oscar_ring_integers(FG::GAP.GapObj) FO = ZZ finv, f = _iso_oscar_gap_ring_integers_functions(FO, FG) - return MapFromFunc(f, finv, FG, FO) + return MapFromFunc(FG, FO, f, finv) end function _iso_gap_oscar_field_cyclotomic(FG::GAP.GapObj) FO = cyclotomic_field(GAPWrap.Conductor(FG))[1] finv, f = _iso_oscar_gap_field_cyclotomic_functions(FO, FG) - return MapFromFunc(f, finv, FG, FO) + return MapFromFunc(FG, FO, f, finv) end function _iso_gap_oscar_field_quadratic(FG::GAP.GapObj) @@ -105,7 +105,7 @@ function _iso_gap_oscar_field_quadratic(FG::GAP.GapObj) error("do not know how to handle FG") end - return MapFromFunc(f, finv, FG, FO) + return MapFromFunc(FG, FO, f, finv) end # If `FG` is a number field that is not cyclotomic then @@ -197,14 +197,14 @@ function _iso_gap_oscar_number_field(FG::GapObj) error("do not know how to handle FG") end - return MapFromFunc(f, finv, FG, FO) + return MapFromFunc(FG, FO, f, finv) end function _iso_gap_oscar_abelian_closure(FG::GAP.GapObj) FO, _ = abelian_closure(QQ) finv, f = _iso_oscar_gap_abelian_closure_functions(FO, FG) - return MapFromFunc(f, finv, FG, FO) + return MapFromFunc(FG, FO, f, finv) end function _iso_gap_oscar_univariate_polynomial_ring(RG::GAP.GapObj) @@ -212,7 +212,7 @@ function _iso_gap_oscar_univariate_polynomial_ring(RG::GAP.GapObj) RO, x = polynomial_ring(codomain(coeffs_iso), "x", cached = false) finv, f = _iso_oscar_gap_polynomial_ring_functions(RO, RG, inv(coeffs_iso)) - return MapFromFunc(f, finv, RG, RO) + return MapFromFunc(RG, RO, f, finv) end function _iso_gap_oscar_multivariate_polynomial_ring(RG::GAP.GapObj) @@ -221,7 +221,7 @@ function _iso_gap_oscar_multivariate_polynomial_ring(RG::GAP.GapObj) RO, x = polynomial_ring(codomain(coeffs_iso), nams, cached = false) finv, f = _iso_oscar_gap_polynomial_ring_functions(RO, RG, inv(coeffs_iso)) - return MapFromFunc(f, finv, RG, RO) + return MapFromFunc(RG, RO, f, finv) end diff --git a/src/GAP/iso_oscar_gap.jl b/src/GAP/iso_oscar_gap.jl index 6fada67d09e3..c507efa01edd 100644 --- a/src/GAP/iso_oscar_gap.jl +++ b/src/GAP/iso_oscar_gap.jl @@ -52,7 +52,7 @@ function _iso_oscar_gap(RO::Union{Nemo.zzModRing, Nemo.ZZModRing}) RG = GAPWrap.mod(GAP.Globals.Integers::GapObj, GAP.Obj(n)) f, finv = _iso_oscar_gap_residue_ring_functions(RO, RG) - return MapFromFunc(f, finv, RO, RG) + return MapFromFunc(RO, RG, f, finv) end # Assume that `FO` and `FG` are finite fields of the same order @@ -190,7 +190,7 @@ function _iso_oscar_gap(FO::FinField) end f, finv = _iso_oscar_gap_field_finite_functions(FO, FG) - return MapFromFunc(f, finv, FO, FG) + return MapFromFunc(FO, FG, f, finv) end @@ -204,7 +204,7 @@ function _iso_oscar_gap(FO::QQField) f, finv = _iso_oscar_gap_field_rationals_functions(FO, FG) - return MapFromFunc(f, finv, FO, FG) + return MapFromFunc(FO, FG, f, finv) end function _iso_oscar_gap_ring_integers_functions(FO::ZZRing, FG::GapObj) @@ -217,7 +217,7 @@ function _iso_oscar_gap(FO::ZZRing) f, finv = _iso_oscar_gap_ring_integers_functions(FO, FG) - return MapFromFunc(f, finv, FO, FG) + return MapFromFunc(FO, FG, f, finv) end # Assume that `FO` and `FG` are cyclotomic fields with the same conductor @@ -305,7 +305,7 @@ function _iso_oscar_gap(FO::SimpleNumField{QQFieldElem}) end end - return MapFromFunc(f, finv, FO, FG) + return MapFromFunc(FO, FG, f, finv) end # Deal with simple extensions of proper extensions of Q. @@ -332,7 +332,7 @@ function _iso_oscar_gap(FO::SimpleNumField{T}) where T <: FieldElem return FO(coeffs) end - return MapFromFunc(f, finv, FO, FG) + return MapFromFunc(FO, FG, f, finv) end # Deal with non-simple extensions of Q or of extensions of Q. @@ -366,7 +366,7 @@ function _iso_oscar_gap(FO::NumField) end end - return MapFromFunc(f, finv, FO, FG) + return MapFromFunc(FO, FG, f, finv) end @@ -379,7 +379,7 @@ function _iso_oscar_gap(FO::QQAbField) FG = GAP.Globals.Cyclotomics::GapObj f, finv = _iso_oscar_gap_abelian_closure_functions(FO, FG) - return MapFromFunc(f, finv, FO, FG) + return MapFromFunc(FO, FG, f, finv) end """ @@ -487,7 +487,7 @@ function _iso_oscar_gap(RO::PolyRing) f, finv = _iso_oscar_gap_polynomial_ring_functions(RO, RG, coeffs_iso) - return MapFromFunc(f, finv, RO, RG) + return MapFromFunc(RO, RG, f, finv) end @@ -543,7 +543,7 @@ function _iso_oscar_gap(RO::MPolyRing{T}) where T f, finv = _iso_oscar_gap_polynomial_ring_functions(RO, RG, coeffs_iso) - return MapFromFunc(f, finv, RO, RG) + return MapFromFunc(RO, RG, f, finv) end diff --git a/src/Groups/GAPGroups.jl b/src/Groups/GAPGroups.jl index 8950a0f3d161..c4beecc90c8f 100644 --- a/src/Groups/GAPGroups.jl +++ b/src/Groups/GAPGroups.jl @@ -269,7 +269,7 @@ Base.inv(x::GAPGroupElem) = group_element(parent(x), GAPWrap.Inverse(x.X)) Base.:^(x::GAPGroupElem, y::Int) = group_element(parent(x), (x.X ^ y)::GapObj) -Base.:^(x::GAPGroupElem, y::ZZRingElem) = Hecke._generic_power(x, y) # TODO: perhaps let GAP handle this; also handle arbitrary Integer subtypes? +Base.:^(x::GAPGroupElem, y::ZZRingElem) = Nemo._generic_power(x, y) # TODO: perhaps let GAP handle this; also handle arbitrary Integer subtypes? Base.:^(x::T, y::T) where T <: GAPGroupElem = group_element(_common_parent_group(parent(x), parent(y)), (x.X ^ y.X)::GapObj) diff --git a/src/Groups/GrpAb.jl b/src/Groups/GrpAb.jl index 88117eb25f4a..0ea9e3db868e 100644 --- a/src/Groups/GrpAb.jl +++ b/src/Groups/GrpAb.jl @@ -366,7 +366,7 @@ is_sporadic_simple(G::GrpAbFinGen) = false function is_pgroup_with_prime(::Type{T}, G::GrpAbFinGen) where T <: IntegerUnion is_trivial(G) && return true, nothing is_finite(G) || return false, nothing - flag, p, e = is_prime_power_with_data(order(G)) + flag, _, p = is_prime_power_with_data(order(G)) flag && return true, T(p) return false, nothing end @@ -382,7 +382,7 @@ nilpotency_class(G::GrpAbFinGen) = (order(G) == 1 ? 0 : 1) # prime_of_pgroup. # TODO: enhance @gapattribute so this is not necessary function _prime_of_pgroup(G::GrpAbFinGen) - flag, p, e = is_prime_power_with_data(order(G)) + flag, _, p = is_prime_power_with_data(order(G)) @req flag "only supported for non-trivial p-groups" return p end diff --git a/src/Groups/group_characters.jl b/src/Groups/group_characters.jl index bcaaa131efce..81c43f8c576d 100644 --- a/src/Groups/group_characters.jl +++ b/src/Groups/group_characters.jl @@ -132,7 +132,7 @@ end function isomorphism_to_GAP_group(G::GAPGroup) f = function(x) return x.X; end finv = function(x::GAP.Obj) return group_element(G, x); end - return MapFromFunc(f, finv, G, G.X) + return MapFromFunc(G, G.X, f, finv) end function isomorphism_to_GAP_group(G::GrpAbFinGen) @@ -142,7 +142,7 @@ function isomorphism_to_GAP_group(G::GrpAbFinGen) @assert C isa GAPGroup f = function(x) return iso(x).X; end finv = function(x::GAP.Obj) return preimage(iso, group_element(C, x)); end - return MapFromFunc(f, finv, G, C.X) + return MapFromFunc(G, C.X, f, finv) end function isomorphism_to_GAP_group(tbl::GAPGroupCharacterTable) @@ -1859,7 +1859,7 @@ function character_field(chi::GAPGroupClassFunction) end end - return F, MapFromFunc(f, finv, F, FF) + return F, MapFromFunc(F, FF, f, finv) end @doc raw""" diff --git a/src/Groups/homomorphisms.jl b/src/Groups/homomorphisms.jl index 7c5d77bc21a7..e3a57188a050 100644 --- a/src/Groups/homomorphisms.jl +++ b/src/Groups/homomorphisms.jl @@ -548,7 +548,7 @@ function isomorphism(::Type{GrpAbFinGen}, G::GAPGroup) return group_element(G, res) end - return GroupIsomorphismFromFunc(f, finv, G, A) + return GroupIsomorphismFromFunc(G, A, f, finv) end::GroupIsomorphismFromFunc{typeof(G), GrpAbFinGen} end @@ -624,7 +624,7 @@ function isomorphism(::Type{T}, A::GrpAbFinGen) where T <: GAPGroup return Aindep_to_A(Aindep(exp)) end - return GroupIsomorphismFromFunc(f, finv, A, G) + return GroupIsomorphismFromFunc(A, G, f, finv) end::GroupIsomorphismFromFunc{GrpAbFinGen, T} end @@ -633,12 +633,12 @@ mutable struct GroupIsomorphismFromFunc{R, T} <: Map{R, T, Hecke.HeckeMap, MapFr map::MapFromFunc{R, T} end -function GroupIsomorphismFromFunc{R, T}(f, g, D::R, C::T) where {R, T} - return GroupIsomorphismFromFunc{R, T}(MapFromFunc(f, g, D, C)) +function GroupIsomorphismFromFunc{R, T}(D::R, C::T, f, g) where {R, T} + return GroupIsomorphismFromFunc{R, T}(MapFromFunc(D, C, f, g)) end -function GroupIsomorphismFromFunc(f, g, D, C) - return GroupIsomorphismFromFunc{typeof(D), typeof(C)}(f, g, D, C) +function GroupIsomorphismFromFunc(D, C, f, g) + return GroupIsomorphismFromFunc{typeof(D), typeof(C)}(D, C, f, g) end # install the same methods as for `MapFromFunc`, @@ -731,9 +731,9 @@ function isomorphism(::Type{FPGroup}, A::GrpAbFinGen) @assert is_finite(A) == is_finite(F) is_finite(A) && @assert order(A) == order(F) return MapFromFunc( + A, F, y->F([i => y[i] for i=1:ngens(A)]), - x->sum([w.second*gen(A, w.first) for w = syllables(x)], init = zero(A)), - A, F) + x->sum([w.second*gen(A, w.first) for w = syllables(x)], init = zero(A))) end::MapFromFunc{GrpAbFinGen, FPGroup} end @@ -793,7 +793,7 @@ function isomorphism(::Type{T}, A::GrpGen) where T <: GAPGroup finv = function(g) return bwd[g] end - return MapFromFunc(f, finv, A, GP) + return MapFromFunc(A, GP, f, finv) else m = isomorphism(T, GP) @@ -805,7 +805,7 @@ function isomorphism(::Type{T}, A::GrpGen) where T <: GAPGroup return bwd[preimage(m, g)] end - return MapFromFunc(f, finv, A, codomain(m)) + return MapFromFunc(A, codomain(m), f, finv) end end::MapFromFunc{GrpGen, T} end diff --git a/src/Groups/matrices/MatGrp.jl b/src/Groups/matrices/MatGrp.jl index 8558f2a849db..bc72e0ace871 100644 --- a/src/Groups/matrices/MatGrp.jl +++ b/src/Groups/matrices/MatGrp.jl @@ -864,7 +864,7 @@ julia> gens(H) ``` """ function unitary_group(n::Int, q::Int) - fl, b, a = is_prime_power_with_data(q) + fl, a, b = is_prime_power_with_data(q) @req fl "The field size must be a prime power" G = MatrixGroup(n,GF(b, 2*a)) G.descr = :GU @@ -890,7 +890,7 @@ julia> gens(H) ``` """ function special_unitary_group(n::Int, q::Int) - fl, b, a = is_prime_power_with_data(q) + fl, a, b = is_prime_power_with_data(q) @req fl "The field size must be a prime power" G = MatrixGroup(n,GF(b, 2*a)) G.descr = :SU diff --git a/src/Groups/matrices/iso_nf_fq.jl b/src/Groups/matrices/iso_nf_fq.jl index 7e9e7523a725..b2125e23e2e3 100644 --- a/src/Groups/matrices/iso_nf_fq.jl +++ b/src/Groups/matrices/iso_nf_fq.jl @@ -74,7 +74,7 @@ function _isomorphic_group_over_finite_field(G::MatrixGroup{T}) where T <: Union preimg = function(y) return one(G) end - return Gp, MapFromFunc(img, preimg, G, Gp) + return Gp, MapFromFunc(G, Gp, img, preimg) end matrices = map(x -> x.elm, gens(G)) @@ -93,7 +93,7 @@ function _isomorphic_group_over_finite_field(G::MatrixGroup{T}) where T <: Union GAP.GapObj(gen)) end - return Gp, MapFromFunc(img, preimg, G, Gp) + return Gp, MapFromFunc(G, Gp, img, preimg) end function isomorphic_group_over_finite_field(G::MatrixGroup{T}) where T <: Union{ZZRingElem, QQFieldElem, nf_elem} diff --git a/src/Groups/matrices/matrix_manipulation.jl b/src/Groups/matrices/matrix_manipulation.jl index 9219083ddff4..63d1fd006f70 100644 --- a/src/Groups/matrices/matrix_manipulation.jl +++ b/src/Groups/matrices/matrix_manipulation.jl @@ -152,7 +152,7 @@ end permutation_matrix(F::Ring, p::PermGroupElem) = permutation_matrix(F, Vector(p)) -^(a::MatElem, b::ZZRingElem) = Hecke._generic_power(a, b) +^(a::MatElem, b::ZZRingElem) = Nemo._generic_power(a, b) ######################################################################## # diff --git a/src/Groups/spinor_norms.jl b/src/Groups/spinor_norms.jl index ca2efd3f5437..780001d4b856 100644 --- a/src/Groups/spinor_norms.jl +++ b/src/Groups/spinor_norms.jl @@ -259,7 +259,7 @@ function _det_spin_group(primes::Vector{ZZRingElem}; infinity = true) #@assert infinity K, _ = Hecke.rationals_as_number_field() # f : QQ -> K - f = MapFromFunc(x -> K(x), x -> coeff(x, 0), QQ, K) + f = MapFromFunc(QQ, K, x -> K(x), x -> coeff(x, 0)) OK = maximal_order(K) primes_as_ideals = [prime_decomposition(OK, p)[1][1] for p in primes] stuff = [Hecke.local_multiplicative_group_modulo_squares(P) for P in primes_as_ideals] @@ -267,7 +267,7 @@ function _det_spin_group(primes::Vector{ZZRingElem}; infinity = true) maps = Any[s[2] for s in stuff] if infinity Ainf = abelian_group(2) - minf = MapFromFunc(x -> iszero(x[1]) ? one(K) : -one(K), x -> coeff(x, 0) > 0 ? Ainf([0]) : Ainf([1]), Ainf, K) + minf = MapFromFunc(Ainf, K, x -> iszero(x[1]) ? one(K) : -one(K), x -> coeff(x, 0) > 0 ? Ainf([0]) : Ainf([1])) push!(grps, Ainf) push!(maps, minf) end @@ -299,7 +299,7 @@ function _det_spin_group(primes::Vector{ZZRingElem}; infinity = true) grps_det = [abelian_group(2) for i in 1:length(primes)] push!(grps_det, A) D, projD, injD = direct_product(grps_det...,task=:both) - maps_det = [(primes[i],MapFromFunc(x-> isone(x) ? zero(grps_det[i]) : grps_det[i][1], ZZ, grps_det[i])*injD[i]) for i in 1:length(primes)] + maps_det = [(primes[i],MapFromFunc(ZZ, grps_det[i], x-> isone(x) ? zero(grps_det[i]) : grps_det[i][1])*injD[i]) for i in 1:length(primes)] maps_det = Dict(maps_det) projd = Any[(primes[i],projD[end]*proj[i]*maps[i]*inv(f)) for i in 1:length(primes)] injd = Any[(primes[i],f*inv(maps[i])*inj[i]*injD[end]) for i in 1:length(primes)] @@ -309,7 +309,7 @@ function _det_spin_group(primes::Vector{ZZRingElem}; infinity = true) end projd = Dict(projd) injd = Dict(injd) - diagonal_morphism = MapFromFunc(forwardmap, backwardmap, A, QQ) + diagonal_morphism = MapFromFunc(A, QQ, forwardmap, backwardmap) return D, inv(diagonal_morphism)*injD[end], projd, injd, maps_det end @@ -414,7 +414,7 @@ function det_spin_homomorphism(L::ZZLat; signed=false) g = u * fp * inv(u) while true R = residue_ring(ZZ, p^(prec+3)) - conv = MapFromFunc(x -> R(numerator(x)) * R(denominator(x)^(-1)), QQ, R) + conv = MapFromFunc(QQ, R, x -> R(numerator(x)) * R(denominator(x)^(-1))) _g = Hecke.hensel_qf(map_entries(conv, q0), change_base_ring(R, g), prec0, prec, p) g = change_base_ring(ZZ, _g) gg = t*M*g*inv(t*M) diff --git a/src/InvariantTheory/invariant_rings.jl b/src/InvariantTheory/invariant_rings.jl index 0f562896ead1..e6de3258fc7b 100644 --- a/src/InvariantTheory/invariant_rings.jl +++ b/src/InvariantTheory/invariant_rings.jl @@ -98,7 +98,7 @@ function right_action(R::MPolyRing{T}, M::MatrixElem{T}) where T right_action_by_M = (f::MPolyRingElem{T}) -> evaluate(f, vars) - return MapFromFunc(right_action_by_M, R, R) + return MapFromFunc(R, R, right_action_by_M) end right_action(R::MPolyRing{T}, M::MatrixGroupElem{T}) where T = right_action(R, M.elm) @@ -111,7 +111,7 @@ function right_action(R::MPolyRing{T}, p::PermGroupElem) where T right_action_by_p = (f::MPolyRingElem{T}) -> on_indeterminates(f, p) - return MapFromFunc(right_action_by_p, R, R) + return MapFromFunc(R, R, right_action_by_p) end right_action(f::MPolyRingElem, p::PermGroupElem) = right_action(parent(f), p)(f) @@ -138,7 +138,7 @@ function reynolds_operator(IR::InvRing{FldT, GrpT, PolyRingElemT}) where {FldT, return g*base_ring(f)(1//order(group(IR))) end - IR.reynolds_operator = MapFromFunc(reynolds, polynomial_ring(IR), polynomial_ring(IR)) + IR.reynolds_operator = MapFromFunc(polynomial_ring(IR), polynomial_ring(IR), reynolds) return IR.reynolds_operator end @@ -264,7 +264,7 @@ function reynolds_operator(IR::InvRing{FldT, GrpT, PolyRingElemT}, chi::GAPGroup return g*base_ring(f)(1//order(group(IR))) end - return MapFromFunc(reynolds, polynomial_ring(IR), polynomial_ring(IR)) + return MapFromFunc(polynomial_ring(IR), polynomial_ring(IR), reynolds) end @doc raw""" diff --git a/src/Modules/FreeModules-graded.jl b/src/Modules/FreeModules-graded.jl index 79bd3026a69f..728c244f560b 100644 --- a/src/Modules/FreeModules-graded.jl +++ b/src/Modules/FreeModules-graded.jl @@ -990,7 +990,7 @@ function hom(F::FreeModule_dec, G::FreeModule_dec) end return FreeModuleElem_dec(s, GH) end - return GH, Hecke.MapFromFunc(im, pre, GH, X) + return GH, MapFromFunc(GH, X, im, pre) end function kernel(h::FreeModuleHom_dec) #ONLY for free modules... @@ -1129,7 +1129,7 @@ function hom(M::ModuleFP_dec, N::ModuleFP_dec) return H(preimage(psi, (preimage(mH_s0_t0, g))).a) return SubquoDecModuleElem(emb[1](preimage(mH_s0_t0, g)), H) end - return H, MapFromFunc(im, pr, H, Hecke.MapParent(M, N, "homomorphisms")) + return H, MapFromFunc(H, Hecke.MapParent(M, N, "homomorphisms"), im, pr) end #TODO @@ -1287,7 +1287,7 @@ function tensor_product(G::FreeModule_dec...; task::Symbol = :none) return Tuple(gen(G[i], t[e.r.pos[1]][i]) for i = 1:length(G)) end - return F, MapFromFunc(pure, inv_pure, Hecke.TupleParent(Tuple([g[0] for g = G])), F) + return F, MapFromFunc(Hecke.TupleParent(Tuple([g[0] for g = G])), F, pure, inv_pure) end ⊗(G::ModuleFP_dec...) = tensor_product(G..., task = :none) @@ -1396,5 +1396,5 @@ function homogeneous_component(F::T, d::GrpAbFinGenElem) where {T <: Union{FreeM end return z end - return X, Hecke.MapFromFunc(im, pr, X, F) + return X, MapFromFunc(X, F, im, pr) end diff --git a/src/Modules/ModulesGraded.jl b/src/Modules/ModulesGraded.jl index 5e95e0c948f3..433f51c083f8 100644 --- a/src/Modules/ModulesGraded.jl +++ b/src/Modules/ModulesGraded.jl @@ -1044,9 +1044,7 @@ julia> m = x*y*z*M[1] x*y^2*z*e[1] julia> degree(m) -Element of -GrpAb: Z -with components [5] +Element of Z with components [5] julia> degree(Int, m) 5 @@ -1130,9 +1128,7 @@ y*e[1] -> x^2*y*e[1] Graded module homomorphism of degree [2] julia> degree(a) -Element of -GrpAb: Z -with components [2] +Element of Z with components [2] ``` """ function degree(f::SubQuoHom) @@ -1877,7 +1873,7 @@ function tensor_product(G::FreeMod_dec...; task::Symbol = :none) if task == :none return F end - return F, MapFromFunc(pure, inv_pure, Hecke.TupleParent(Tuple([g[0] for g = G])), F) + return F, MapFromFunc(Hecke.TupleParent(Tuple([g[0] for g = G])), F, pure, inv_pure) end @@ -1924,7 +1920,7 @@ function hom(F::FreeMod_dec, G::FreeMod_dec) return FreeModElem_dec(undecorated_v, GH) end - to_hom_map = Hecke.MapFromFunc(im, pre, GH, X) + to_hom_map = MapFromFunc(GH, X, im, pre) set_attribute!(GH, :show => Hecke.show_hom, :hom => (F, G), :module_to_hom_map => to_hom_map) return GH, to_hom_map end diff --git a/src/Modules/UngradedModules.jl b/src/Modules/UngradedModules.jl index 9424def14548..aa261b343854 100644 --- a/src/Modules/UngradedModules.jl +++ b/src/Modules/UngradedModules.jl @@ -5578,7 +5578,7 @@ function hom(F::FreeMod, G::FreeMod) end return FreeModElem(s, GH) end - to_hom_map = Hecke.MapFromFunc(im, pre, GH, X) + to_hom_map = MapFromFunc(GH, X, im, pre) set_attribute!(GH, :show => Hecke.show_hom, :hom => (F, G), :module_to_hom_map => to_hom_map) return GH, to_hom_map end @@ -6697,7 +6697,7 @@ function hom(M::ModuleFP, N::ModuleFP, algorithm::Symbol=:maps) return s_proj(SubquoModuleElem(repres(preimage(mH_s0_t0, g)), H)) end - to_hom_map = MapFromFunc(im, pre, H_simplified, Hecke.MapParent(M, N, "homomorphisms")) + to_hom_map = MapFromFunc(H_simplified, Hecke.MapParent(M, N, "homomorphisms"), im, pre) set_attribute!(H_simplified, :show => Hecke.show_hom, :hom => (M, N), :module_to_hom_map => to_hom_map) return H_simplified, to_hom_map end @@ -6886,9 +6886,9 @@ function *(h::ModuleFPHom{T1, T2, <:Any}, g::ModuleFPHom{T2, T3, <:Any}) where { @assert codomain(h) === domain(g) return hom(domain(h), codomain(g), Vector{elem_type(codomain(g))}([g(h(x)) for x = gens(domain(h))]), - Hecke.MapFromFunc(x->(base_ring_map(g)(base_ring_map(h)(x))), - base_ring(domain(h)), - base_ring(codomain(g))) + MapFromFunc(base_ring(domain(h)), + base_ring(codomain(g)), + x->(base_ring_map(g)(base_ring_map(h)(x)))) ) end @@ -7281,7 +7281,7 @@ function tensor_product(G::FreeMod...; task::Symbol = :none) return F end - return F, MapFromFunc(pure, inv_pure, Hecke.TupleParent(Tuple([g[0] for g = G])), F) + return F, MapFromFunc(Hecke.TupleParent(Tuple([g[0] for g = G])), F, pure, inv_pure) end ⊗(G::ModuleFP...) = tensor_product(G..., task = :none) @@ -7471,7 +7471,7 @@ function tensor_product(G::ModuleFP...; task::Symbol = :none) return s end - return s, MapFromFunc(pure, Hecke.TupleParent(Tuple([g[0] for g = G])), s) + return s, MapFromFunc(Hecke.TupleParent(Tuple([g[0] for g = G])), s, pure) end ############################# @@ -8583,7 +8583,7 @@ function hom_matrices(M::SubquoModule{T},N::SubquoModule{T},simplify_task=true) return p(SQ(v)) end - to_hom_map = MapFromFunc(to_homomorphism, to_subquotient_elem, SQ2, Hecke.MapParent(M, N, "homomorphisms")) + to_hom_map = MapFromFunc(SQ2, Hecke.MapParent(M, N, "homomorphisms"), to_homomorphism, to_subquotient_elem) set_attribute!(SQ2, :hom => (M, N), :module_to_hom_map => to_hom_map) return SQ2, to_hom_map @@ -8599,7 +8599,7 @@ function hom_matrices(M::SubquoModule{T},N::SubquoModule{T},simplify_task=true) return SubQuoHom(M,N,A) end - to_hom_map = MapFromFunc(to_homomorphism, to_subquotient_elem, SQ, Hecke.MapParent(M, N, "homomorphisms")) + to_hom_map = MapFromFunc(SQ, Hecke.MapParent(M, N, "homomorphisms"), to_homomorphism, to_subquotient_elem) set_attribute!(SQ, :hom => (M, N), :module_to_hom_map => to_hom_map) return SQ, to_hom_map @@ -8610,7 +8610,7 @@ function change_base_ring(S::Ring, F::FreeMod) R = base_ring(F) r = ngens(F) FS = FreeMod(S, F.S) # the symbols of F - map = hom(F, FS, gens(FS), MapFromFunc(x->S(x), R, S)) + map = hom(F, FS, gens(FS), MapFromFunc(R, S, x->S(x))) return FS, map end @@ -8630,7 +8630,7 @@ function change_base_ring(S::Ring, M::SubquoModule) g = ambient_representatives_generators(M) rels = relations(M) MS = SubquoModule(FS, mapF.(g), mapF.(rels)) - map = SubQuoHom(M, MS, gens(MS), MapFromFunc(x->S(x), R, S)) + map = SubQuoHom(M, MS, gens(MS), MapFromFunc(R, S, x->S(x))) return MS, map end diff --git a/src/NumberTheory/GaloisGrp/GaloisGrp.jl b/src/NumberTheory/GaloisGrp/GaloisGrp.jl index 36e73362dbd5..20b21ab0e098 100644 --- a/src/NumberTheory/GaloisGrp/GaloisGrp.jl +++ b/src/NumberTheory/GaloisGrp/GaloisGrp.jl @@ -476,7 +476,7 @@ mutable struct ComplexRootCtx rt::Vector{acb} function ComplexRootCtx(f::ZZPolyRingElem) @assert ismonic(f) - rt = roots(f, AcbField(20)) + rt = roots(AcbField(20), f) return new(f, 20, rt) end function ComplexRootCtx(f::QQPolyRingElem) @@ -492,7 +492,7 @@ function Hecke.roots(C::GaloisCtx{ComplexRootCtx}, pr::Int = 10; raw::Bool = fal if C.C.pr >= pr return C.C.rt end - rt = roots(C.C.f, AcbField(pr)) + rt = roots(AcbField(pr), C.C.f) C.C.pr = pr n = length(rt) for i=1:n @@ -580,7 +580,7 @@ function Nemo.roots_upper_bound(f::ZZMPolyRingElem, t::Int = 0) F = evaluate(f, [x, Qsx(s)]) dis = numerator(discriminant(F)) @assert !iszero(dis(t)) - rt = roots(dis, AcbField(20)) + rt = roots(AcbField(20), dis) r = Hecke.lower_bound(minimum([abs(x-t) for x = rt]), ZZRingElem) @assert r > 0 ff = map_coefficients(abs, f) @@ -1664,13 +1664,13 @@ If `prime` is given, no search is performed. function find_prime(f::QQPolyRingElem, extra::Int = 5; prime::Int = 0, pStart::Int = 2*degree(f), filter_prime = x->true, filter_pattern = x->true) if prime != 0 p = prime - lf = factor(f, GF(p)) + lf = factor(GF(p), f) return p, Set([CycleType(map(degree, collect(keys(lf.fac))))]) end if pStart < 0 error("should no longer happen") p = -pStart - lf = factor(f, GF(p)) + lf = factor(GF(p), f) return p, Set([CycleType(map(degree, collect(keys(lf.fac))))]) end @@ -1693,7 +1693,7 @@ function find_prime(f::QQPolyRingElem, extra::Int = 5; prime::Int = 0, pStart::I if k(leading_coefficient(f)) == 0 continue end - lf = factor(f, GF(p)) + lf = factor(GF(p), f) if any(x->x>1, values(lf.fac)) continue end @@ -2466,7 +2466,7 @@ ideal(x4^4 - 2, x3^3 + x3^2*x4 + x3*x4^2 + x4^3, x2^2 + x2*x3 + x2*x4 + x3^2 + x julia> k, _ = number_field(i); -julia> length(roots(x^4-2, k)) +julia> length(roots(k, x^4-2)) 4 ``` @@ -2532,7 +2532,7 @@ function galois_ideal(C::GaloisCtx, extra::Int = 5) push!(id, sum(evaluate(I^length(h), x) for I = PE) - v) end h = Hecke.power_sums_to_polynomial(h) - q = roots(h, number_field(C.f)[1]) + q = roots(number_field(C.f)[1], h) @assert length(q) > 0 q = parent(defining_polynomial(parent(q[1])))(q[1]) #TODO: think h(q(y)) is probably boring, while q(y) == pe might be @@ -2605,7 +2605,7 @@ function find_morphism(k::fqPolyRepField, K::fqPolyRepField) if degree(k) > 1 phi = Nemo.find_morphism(k, K) #avoids embed - which stores the info else - phi = MapFromFunc(x->K((coeff(x, 0))), y->k((coeff(y, 0))), k, K) + phi = MapFromFunc(k, K, x->K((coeff(x, 0))), y->k((coeff(y, 0)))) end return phi end diff --git a/src/NumberTheory/GaloisGrp/Qt.jl b/src/NumberTheory/GaloisGrp/Qt.jl index 53701b2840c0..dd75c87180e5 100644 --- a/src/NumberTheory/GaloisGrp/Qt.jl +++ b/src/NumberTheory/GaloisGrp/Qt.jl @@ -118,7 +118,7 @@ function _subfields(FF::Generic.FunctionField, f::ZZMPolyRingElem; tStart::Int = @vprint :Subfields 2 "for $f\n" d = numerator(discriminant(FF)) - rt = roots(d, AcbField(20)) + rt = roots(AcbField(20), d) t = tStart local g::ZZPolyRingElem while true @@ -140,7 +140,7 @@ function _subfields(FF::Generic.FunctionField, f::ZZMPolyRingElem; tStart::Int = @vprint :Subfields 2 "now looking for a nice prime...\n" p, _ = find_prime(defining_polynomial(K), pStart = 200) - d = lcm(map(degree, collect(keys(factor(g, GF(p)).fac)))) + d = lcm(map(degree, collect(keys(factor(GF(p), g).fac)))) @assert evaluate(evaluate(f, [X, T+t]), [gen(Zx), zero(Zx)]) == g diff --git a/src/NumberTheory/GaloisGrp/RelGalois.jl b/src/NumberTheory/GaloisGrp/RelGalois.jl index 1487c9f23955..1c6b2b530020 100644 --- a/src/NumberTheory/GaloisGrp/RelGalois.jl +++ b/src/NumberTheory/GaloisGrp/RelGalois.jl @@ -25,7 +25,7 @@ function GaloisCtx(f::PolyRingElem{nf_elem}, P::NfOrdIdl) mF = Hecke.extend(mF, k) d = reduce(lcm, keys(factor_shape(map_coefficients(mF, f)))) D = QadicField(p, d, 10)[1] - mCD = MapFromFunc(x->D(coeff(x, 0)), C, D) + mCD = MapFromFunc(C, D, x->D(coeff(x, 0))) H = Hecke.HenselCtxQadic(map_coefficients(x->mCD(mC(x)), f)) V = Hecke.vanHoeijCtx() V.P = P diff --git a/src/PolyhedralGeometry/solving_integrally.jl b/src/PolyhedralGeometry/solving_integrally.jl index fe45379cbf6a..f223e2d0b9f8 100644 --- a/src/PolyhedralGeometry/solving_integrally.jl +++ b/src/PolyhedralGeometry/solving_integrally.jl @@ -1,3 +1,7 @@ +nrows(A::Polymake.Matrix) = Int(size(A)[1]) + +ncols(A::Polymake.Matrix) = Int(size(A)[2]) + function solve_mixed(as::Type{SubObjectIterator{PointVector{ZZRingElem}}}, A::ZZMatrix, b::ZZMatrix, C::ZZMatrix, d::ZZMatrix) @req ncols(A) == ncols(C) "solve_mixed(A,b,C,d): A and C must have the same number of columns." @req nrows(A) == nrows(b) "solve_mixed(A,b,C,d): A and b must have the same number of rows." diff --git a/src/Rings/MPolyMap/flattenings.jl b/src/Rings/MPolyMap/flattenings.jl index 766ab8d950f9..c3e5473d4365 100644 --- a/src/Rings/MPolyMap/flattenings.jl +++ b/src/Rings/MPolyMap/flattenings.jl @@ -197,7 +197,7 @@ end #S_flat_to_S = hom(S_flat, S, vcat(gens(S), S.(gens(Q))), check=false) - S_flat_to_S = MapFromFunc(my_map, S_flat, S) + S_flat_to_S = MapFromFunc(S_flat, S, my_map) return new{typeof(S), typeof(S_flat), typeof(Q)}(S, S_flat, Q, S_to_S_flat, S_flat_to_S, @@ -234,7 +234,7 @@ return pp*qq end - S_flat_to_S = MapFromFunc(my_map, S_flat, S) + S_flat_to_S = MapFromFunc(S_flat, S, my_map) return new{typeof(S), typeof(S_flat), typeof(L)}(S, S_flat, L, S_to_S_flat, S_flat_to_S, L_to_S_flat diff --git a/src/Rings/MPolyQuo.jl b/src/Rings/MPolyQuo.jl index 06934305b3e1..465f1b8add9b 100644 --- a/src/Rings/MPolyQuo.jl +++ b/src/Rings/MPolyQuo.jl @@ -891,7 +891,7 @@ function quo(R::MPolyRing, I::MPolyIdeal) function pr(a::MPolyQuoRingElem) return a.f end - return q, MapFromFunc(im, pr, R, q) + return q, MapFromFunc(R, q, im, pr) end function quo(R::MPolyRing, I::Vector{<:MPolyRingElem}) @@ -1139,7 +1139,7 @@ function vector_space(K::AbstractAlgebra.Field, Q::MPolyQuoRing) end return result end - return V, MapFromFunc(im, prim, V, Q) + return V, MapFromFunc(V, Q, im, prim) end # To fix printing of fraction fields of MPolyQuoRing @@ -1510,7 +1510,7 @@ function homogeneous_component(W::MPolyQuoRing{<:MPolyDecRingElem}, d::GrpAbFinG s, ms = sub(H, collect(q)) Q, mQ = quo(H, s) # set_attribute!(Q, :show => show_homo_comp, :data => (W, d)) - return Q, MapFromFunc(x->W(mH((preimage(mQ, x)))), y->mQ(preimage(mH, y.f)), Q, W) + return Q, MapFromFunc(Q, W, x->W(mH((preimage(mQ, x)))), y->mQ(preimage(mH, y.f))) end function homogeneous_component(W::MPolyQuoRing{<:MPolyDecRingElem}, g::Vector{<:IntegerUnion}) diff --git a/src/Rings/PBWAlgebraQuo.jl b/src/Rings/PBWAlgebraQuo.jl index 72528d77fad5..748c41ec6b71 100644 --- a/src/Rings/PBWAlgebraQuo.jl +++ b/src/Rings/PBWAlgebraQuo.jl @@ -258,7 +258,7 @@ function quo(Q::PBWAlgRing, I::PBWAlgIdeal; SpecialImpl::Union{Nothing, Singula function pr(a::PBWAlgQuoElem) return a.data end - return q, MapFromFunc(im, pr, Q, q) + return q, MapFromFunc(Q, q, im, pr) end diff --git a/src/Rings/affine-algebra-homs.jl b/src/Rings/affine-algebra-homs.jl index 70757990723f..1edb8a310354 100644 --- a/src/Rings/affine-algebra-homs.jl +++ b/src/Rings/affine-algebra-homs.jl @@ -115,7 +115,7 @@ mutable struct AlgHom{T} <: AbstractAlgebra.Map{Ring, Ring, Dx = singular_ring(D) Cx = singular_ring(C) - z = new(D, C, V, MapFromFunc(x->evaluate(x, V), D, C), Singular.AlgebraHomomorphism(Dx, Cx, Cx.(V))) + z = new(D, C, V, MapFromFunc(D, C, x->evaluate(x, V)), Singular.AlgebraHomomorphism(Dx, Cx, Cx.(V))) return z end @@ -130,7 +130,7 @@ mutable struct AlgHom{T} <: AbstractAlgebra.Map{Ring, Ring, Dx = singular_ring(D) Cx = singular_ring(C) - z = new(D, C, V, MapFromFunc(x->evaluate(x, V), base_ring(D), C), Singular.AlgebraHomomorphism(Dx, Cx, Cx.(V))) + z = new(D, C, V, MapFromFunc(base_ring(D), C, x->evaluate(x, V)), Singular.AlgebraHomomorphism(Dx, Cx, Cx.(V))) return z end @@ -144,7 +144,7 @@ mutable struct AlgHom{T} <: AbstractAlgebra.Map{Ring, Ring, Dx = singular_ring(D) Cx = singular_ring(C) - z = new(D, C, V, MapFromFunc(x->evaluate(x, V), D.R, C), Singular.AlgebraHomomorphism(Dx, Cx, Cx.(V))) + z = new(D, C, V, MapFromFunc(D.R, C, x->evaluate(x, V)), Singular.AlgebraHomomorphism(Dx, Cx, Cx.(V))) return z end end diff --git a/src/Rings/mpoly-affine-algebras.jl b/src/Rings/mpoly-affine-algebras.jl index b6190cc0ae8c..4042a3ec988d 100644 --- a/src/Rings/mpoly-affine-algebras.jl +++ b/src/Rings/mpoly-affine-algebras.jl @@ -371,10 +371,7 @@ GrpAb: Z^2 julia> G = abelian_group(ZZMatrix([1 -1])); julia> g = gen(G, 1) -Element of -(General) abelian group with relation matrix -[1 -1] -with components [0 1] +Element of G with components [0 1] julia> W = [g, g, g, g]; @@ -555,10 +552,7 @@ GrpAb: Z^2 julia> G = abelian_group(ZZMatrix([1 -1])); julia> g = gen(G, 1) -Element of -(General) abelian group with relation matrix -[1 -1] -with components [0 1] +Element of G with components [0 1] julia> W = [g, g, g, g]; diff --git a/src/Rings/mpoly-graded.jl b/src/Rings/mpoly-graded.jl index 5187e8b65fad..889ccf5ea3e8 100644 --- a/src/Rings/mpoly-graded.jl +++ b/src/Rings/mpoly-graded.jl @@ -288,10 +288,7 @@ false julia> G = abelian_group(ZZMatrix([1 -1])); julia> g = gen(G, 1) -Element of -(General) abelian group with relation matrix -[1 -1] -with components [0 1] +Element of G with components [0 1] julia> W = [g, g, g, g]; @@ -1336,7 +1333,7 @@ function vector_space(K::AbstractAlgebra.Field, e::Vector{T}; target = nothing) end return v end - h = MapFromFunc(x -> sum(x[i] * b[i] for i in 1:length(b); init = zero(R)), g, F, R) + h = MapFromFunc(F, R, x -> sum(x[i] * b[i] for i in 1:length(b); init = zero(R)), g) return F, h end diff --git a/src/Rings/mpoly-localizations.jl b/src/Rings/mpoly-localizations.jl index 813910a55867..51b28fe2f036 100644 --- a/src/Rings/mpoly-localizations.jl +++ b/src/Rings/mpoly-localizations.jl @@ -1155,7 +1155,7 @@ Localization of multivariate polynomial ring in 3 variables over QQ at complemen function Localization(S::AbsMPolyMultSet) R = ambient_ring(S) Rloc = MPolyLocRing(R, S) - #iota = MapFromFunc(x -> Rloc(x), R, Rloc) + #iota = MapFromFunc(R, Rloc, x -> Rloc(x)) iota = hom(R, Rloc, Rloc.(gens(R)), check=false) return Rloc, iota end @@ -1173,7 +1173,7 @@ function Localization( issubset(S, inverted_set(W)) && return W, identity_map(W) U = S*inverted_set(W) L, _ = Localization(U) - #return L, MapFromFunc((x->(L(numerator(x), denominator(x), check=false))), W, L) + #return L, MapFromFunc(W, L, (x->(L(numerator(x), denominator(x), check=false)))) return L, MPolyLocalizedRingHom(W, L, hom(base_ring(W), L, L.(gens(base_ring(W)))), check=false) end @@ -1196,7 +1196,7 @@ function Localization( h = gcd(prod(g), f) L = MPolyLocRing(R, MPolyPowersOfElement(R, vcat(g, divexact(f, h)))) return L, MPolyLocalizedRingHom(W, L, hom(base_ring(W), L, L.(gens(base_ring(W)))), check=false) - #return L, MapFromFunc((x->L(numerator(x), denominator(x), check=false)), W, L) + #return L, MapFromFunc(W, L, (x->L(numerator(x), denominator(x), check=false))) end function Localization( @@ -1208,7 +1208,7 @@ function Localization( V = Localization(V, f) end return V, MPolyLocalizedRingHom(W, V, hom(base_ring(W), V, V.(gens(base_ring(W)))), check=false) - #return V, MapFromFunc((x->V(numerator(x), denominator(x), check=false)), W, V) + #return V, MapFromFunc(W, V, (x->V(numerator(x), denominator(x), check=false))) end ### generation of random elements @@ -1587,10 +1587,10 @@ Ideals in localizations of polynomial rings. W::MPolyLocRing, gens::Vector{LocRingElemType}; map_from_base_ring::Hecke.Map = MapFromFunc( + base_ring(W), + W, x->W(x), y->(isone(denominator(y)) ? numerator(y) : divexact(numerator(y), denominator(y))), - base_ring(W), - W ) ) where {LocRingElemType<:AbsLocalizedRingElem} for f in gens @@ -1938,9 +1938,9 @@ function coordinate_shift( xs = [ x + a for (x, a) in zip(gens(base_ring(L)), a) ] xs_inv = [ x - a for (x, a) in zip(gens(base_ring(L)), a) ] shift = MapFromFunc( + L, Ls, f -> Ls(evaluate(numerator(f), xs), evaluate(denominator(f), xs), check=false), g -> L(evaluate(numerator(g), xs_inv), evaluate(denominator(g), xs_inv), check=false), - L, Ls ) set_attribute!(L, :coordinate_shift, shift) end @@ -2930,7 +2930,7 @@ function Localization(R::MPolyRing, f::MPolyRingElem) isone(denominator(a)) && return numerator(a) return divexact(numerator(a), denominator(a)) end - return L, MapFromFunc(func, func_inv, R, L) + return L, MapFromFunc(R, L, func, func_inv) end ############################################################################# diff --git a/src/Rings/mpolyquo-localizations.jl b/src/Rings/mpolyquo-localizations.jl index 032beab0481c..a2d6724264ae 100644 --- a/src/Rings/mpolyquo-localizations.jl +++ b/src/Rings/mpolyquo-localizations.jl @@ -315,7 +315,7 @@ RQ to Localization of quotient of multivariate polynomial ring at complement of function Localization(Q::MPolyQuoRing{RET}, S::MultSetType) where {RET <: RingElem, MultSetType <: AbsMultSet} L = MPolyQuoLocRing(base_ring(Q), modulus(Q), S, Q, Localization(S)[1]) - return L, MapFromFunc((x->L(lift(x))), Q, L) + return L, MapFromFunc(Q, L, (x->L(lift(x)))) end function Localization( @@ -323,10 +323,10 @@ function Localization( S::AbsMPolyMultSet{BRT, BRET, RT, RET} ) where {BRT, BRET, RT, RET, MST} ambient_ring(S) == base_ring(L) || error("multiplicative set does not belong to the correct ring") - issubset(S, inverted_set(L)) && return L, MapFromFunc(x->x, L, L) + issubset(S, inverted_set(L)) && return L, MapFromFunc(L, L, x->x) U = inverted_set(L)*S W = MPolyQuoLocRing(base_ring(L), modulus(underlying_quotient(L)), U, underlying_quotient(L), Localization(U)[1]) - return W, MapFromFunc((x->W(lifted_numerator(x), lifted_denominator(x), check=false)), L, W) + return W, MapFromFunc(L, W, (x->W(lifted_numerator(x), lifted_denominator(x), check=false))) end function MPolyQuoLocRing(R::RT, I::Ideal{RET}, T::MultSetType) where {RT<:MPolyRing, RET<:MPolyRingElem, MultSetType<:AbsMultSet} @@ -1570,10 +1570,10 @@ Ideals in localizations of affine algebras. W::MPolyQuoLocRing, g::Vector{LocRingElemType}; map_from_base_ring::Hecke.Map = MapFromFunc( + base_ring(W), + W, x->W(x), y->(isone(lifted_denominator(y)) ? lifted_numerator(y) : divexact(lifted_numerator(y), lifted_denominator(y))), - base_ring(W), - W ) ) where {LocRingElemType<:MPolyQuoLocRingElem} for f in g @@ -2024,7 +2024,7 @@ function vector_space(kk::Field, W::MPolyQuoLocRing; set_attribute!(f, :inverse, g) set_attribute!(g, :inverse, f) V, id = vector_space(kk, A) - return V, MapFromFunc(v->g(id(v)), a->preimage(id, f(a)), V, W) + return V, MapFromFunc(V, W, v->g(id(v)), a->preimage(id, f(a))) end function vector_space(kk::Field, W::MPolyQuoLocRing{<:Field, <:FieldElem, @@ -2100,7 +2100,7 @@ function vector_space(kk::Field, W::MPolyQuoLocRing{<:Field, <:FieldElem, end return result end - return V, MapFromFunc(im, prim, V, W) + return V, MapFromFunc(V, W, im, prim) end diff --git a/test/AlgebraicGeometry/Schemes/ProjectiveSchemes.jl b/test/AlgebraicGeometry/Schemes/ProjectiveSchemes.jl index 4b129eb2b067..b34afc4fe8a4 100644 --- a/test/AlgebraicGeometry/Schemes/ProjectiveSchemes.jl +++ b/test/AlgebraicGeometry/Schemes/ProjectiveSchemes.jl @@ -254,7 +254,7 @@ end @test compose(UYtoY, YtoX) == UYtoX WW = hypersurface_complement(ambient_scheme(W), [x-y]) - phi = MapFromFunc(restriction_map(W, WW), OO(W), OO(WW)) + phi = MapFromFunc(OO(W), OO(WW), restriction_map(W, WW)) IP2_WW, map = fiber_product(phi, IP2_W) @test base_scheme(IP2_WW) == WW @test !(base_scheme(IP2_WW) === WW) diff --git a/test/Modules/UngradedModules.jl b/test/Modules/UngradedModules.jl index 71d264d9a133..5b92ed5c59a2 100644 --- a/test/Modules/UngradedModules.jl +++ b/test/Modules/UngradedModules.jl @@ -1020,7 +1020,7 @@ end MS, mapM = change_base_ring(S, M) @test iszero(mapM(M[1])) - f = MapFromFunc(x->S(x), R, S) + f = MapFromFunc(R, S, x->S(x)) MS, mapM = change_base_ring(f, M) @test iszero(mapM(M[1])) end diff --git a/test/NumberTheory/galthy.jl b/test/NumberTheory/galthy.jl index a5926a89974e..8c451453cc3f 100644 --- a/test/NumberTheory/galthy.jl +++ b/test/NumberTheory/galthy.jl @@ -8,7 +8,7 @@ U = trivial_subgroup(G)[1] L = fixed_field(C, U) @test degree(L) == order(G) - @test length(roots(k.pol, L)) == 5 + @test length(roots(L, k.pol)) == 5 R, x = polynomial_ring(QQ, "x") pol = x^6 - 366*x^4 - 878*x^3 + 4329*x^2 + 14874*x + 10471 diff --git a/test/Rings/integer-localizations.jl b/test/Rings/integer-localizations.jl index 41597354b39e..eda5f2e78d7c 100644 --- a/test/Rings/integer-localizations.jl +++ b/test/Rings/integer-localizations.jl @@ -144,17 +144,17 @@ inverted_set(W::FmpzLocalizedRing{MultSetType}) where {MultSetType} = W.S::MultS ### required extensions of the localization function function Localization(S::FmpzComplementOfPrimeIdeal) L = FmpzLocalizedRing(S) - return L, MapFromFunc(x->L(x), base_ring(L), L) + return L, MapFromFunc(base_ring(L), L, x->L(x)) end function Localization(S::FmpzComplementOfZeroIdeal) L = FmpzLocalizedRing(S) - return L, MapFromFunc(x->L(x), base_ring(L), L) + return L, MapFromFunc(base_ring(L), L, x->L(x)) end function Localization(S::FmpzPowersOfElement) L = FmpzLocalizedRing(S) - return L, MapFromFunc(x->L(x), base_ring(L), L) + return L, MapFromFunc(base_ring(L), L, x->L(x)) end diff --git a/test/Rings/nmod-localizations.jl b/test/Rings/nmod-localizations.jl index a18b736f1411..6c20866e4cd7 100644 --- a/test/Rings/nmod-localizations.jl +++ b/test/Rings/nmod-localizations.jl @@ -76,7 +76,7 @@ inverted_set(W::NmodLocalizedRing{MultSetType}) where {MultSetType} = W.S::MultS ### required extension of the localization function function Localization(S::NmodComplementOfPrimeIdeal) L = NmodLocalizedRing(S) - return L, MapFromFunc(x->(L(x)), base_ring(L), L) + return L, MapFromFunc(base_ring(L), L, x->(L(x))) end