From 6789ebcab7523e54cdb29fe4484f58fb8b35a7e1 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 27 Feb 2024 13:02:52 +0100 Subject: [PATCH] Frac -> FracFieldElem --- Project.toml | 2 +- src/Arith.jl | 18 +++++++++--------- src/CharTable.jl | 2 +- src/Congruence.jl | 14 +++++++------- src/PrintToTex/Factor.jl | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Project.toml b/Project.toml index 84874c70..91cea848 100644 --- a/Project.toml +++ b/Project.toml @@ -9,5 +9,5 @@ Oscar = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13" [compat] JSON = "^0.20, ^0.21" -Oscar = "0.12, 0.13, 0.14, 0.15, 1.0" +Oscar = "0.15, 1.0" julia = "1.6" diff --git a/src/Arith.jl b/src/Arith.jl index b3f2a4ca..784667d5 100644 --- a/src/Arith.jl +++ b/src/Arith.jl @@ -1,6 +1,6 @@ export e2p -const FracPoly{T} = Generic.UnivPoly{Generic.Frac{T}, Generic.MPoly{Generic.Frac{T}}} where T +const FracPoly{T} = Generic.UnivPoly{Generic.FracFieldElem{T}, Generic.MPoly{Generic.FracFieldElem{T}}} where T const NfPoly = Union{PolyRingElem{QQFieldElem}, PolyRingElem{nf_elem}} """ @@ -220,16 +220,16 @@ Base.:*(factor::Union{Int64, Rational{Int64}}, x::CycloSum{<:NfPoly}) = iszero(f Base.:*(factor::Union{Int64, Rational{Int64}}, x::CycloFrac{<:NfPoly}) = iszero(factor) ? zero(x) : CycloFrac(x.numerator*factor, x.denominator, simplify=false) Base.:*(x::Cyclotomic{<:NfPoly}, factor::Union{Int64, Rational{Int64}}) = factor*x -Base.:*(factor::Generic.Frac{T}, x::Cyclotomic{T}) where T<:PolyRingElem = (numerator(factor)*x)//denominator(factor) -Base.:*(x::Cyclotomic{T}, factor::Generic.Frac{T}) where T<:PolyRingElem = factor*x +Base.:*(factor::Generic.FracFieldElem{T}, x::Cyclotomic{T}) where T<:PolyRingElem = (numerator(factor)*x)//denominator(factor) +Base.:*(x::Cyclotomic{T}, factor::Generic.FracFieldElem{T}) where T<:PolyRingElem = factor*x -Base.:+(x::Union{T,Generic.Frac{T}}, y::Cyclotomic{T}) where T<:PolyRingElem = x*one(y)+y -Base.:+(x::Cyclotomic{T}, y::Union{T,Generic.Frac{T}}) where T<:PolyRingElem = y+x +Base.:+(x::Union{T,Generic.FracFieldElem{T}}, y::Cyclotomic{T}) where T<:PolyRingElem = x*one(y)+y +Base.:+(x::Cyclotomic{T}, y::Union{T,Generic.FracFieldElem{T}}) where T<:PolyRingElem = y+x Base.:+(x::Union{Int64, Rational{Int64}}, y::Cyclotomic{<:NfPoly}) = x*one(y)+y Base.:+(x::Cyclotomic{<:NfPoly}, y::Union{Int64, Rational{Int64}}) = y+x -Base.:-(x::Union{T,Generic.Frac{T}}, y::Cyclotomic{T}) where T<:PolyRingElem = x*one(y)-y -Base.:-(x::Cyclotomic{T}, y::Union{T,Generic.Frac{T}}) where T<:PolyRingElem = x-(y*one(x)) +Base.:-(x::Union{T,Generic.FracFieldElem{T}}, y::Cyclotomic{T}) where T<:PolyRingElem = x*one(y)-y +Base.:-(x::Cyclotomic{T}, y::Union{T,Generic.FracFieldElem{T}}) where T<:PolyRingElem = x-(y*one(x)) Base.:-(x::Union{Int64, Rational{Int64}}, y::Cyclotomic{<:NfPoly}) = x*one(y)-y Base.:-(x::Cyclotomic{<:NfPoly}, y::Union{Int64, Rational{Int64}}) = x-(y*one(x)) @@ -290,8 +290,8 @@ Base.://(x::T, y::Cyclotomic{T}) where T <: PolyRingElem = (x*one(y))//y Base.://(x::Cyclotomic{<:NfPoly}, y::Int64) = (1//y)*x Base.://(x::Int64, y::Cyclotomic{<:NfPoly}) = (x*one(y))//y -Base.://(x::Cyclotomic{T}, y::Generic.Frac{T}) where T <: PolyRingElem = (denominator(y)*x)//numerator(y) -Base.://(x::Generic.Frac{T}, y::Cyclotomic{T}) where T <: PolyRingElem = numerator(x)//(denominator(x)*y) +Base.://(x::Cyclotomic{T}, y::Generic.FracFieldElem{T}) where T <: PolyRingElem = (denominator(y)*x)//numerator(y) +Base.://(x::Generic.FracFieldElem{T}, y::Cyclotomic{T}) where T <: PolyRingElem = numerator(x)//(denominator(x)*y) Base.://(x::Cyclotomic{<:NfPoly}, y::Rational{Int64}) = inv(y)*x Base.://(x::Rational{Int64}, y::Cyclotomic{<:NfPoly}) = (x*one(y))//y diff --git a/src/CharTable.jl b/src/CharTable.jl index aba83da7..7e50a3f3 100644 --- a/src/CharTable.jl +++ b/src/CharTable.jl @@ -49,7 +49,7 @@ struct CharTable{T} <: Table{T} charparams::Vector{Parameters{T}} # Info about the parameters of each character type congruence::Union{Tuple{T, T}, Nothing} # Congruence of the main parameter q (of T). q is congruent to congruence[1] mod congruence[2]. modulusring::PolyRing # Ring of polynomials of type T used in table (also ring of modulus of Cyclotomics) - argumentring::Generic.UniversalPolyRing{Generic.Frac{T}, Generic.MPoly{Generic.Frac{T}}} # Ring of argument of the Cyclotomics in table + argumentring::Generic.UniversalPolyRing{Generic.FracFieldElem{T}, Generic.MPoly{Generic.FracFieldElem{T}}} # Ring of argument of the Cyclotomics in table information::String # General info about the table end diff --git a/src/Congruence.jl b/src/Congruence.jl index ac98f881..23f3cd2b 100644 --- a/src/Congruence.jl +++ b/src/Congruence.jl @@ -1,32 +1,32 @@ -function setcongruence(x::FracPoly{T}, c::Union{T, Generic.Frac{T}}) where T <: NfPoly +function setcongruence(x::FracPoly{T}, c::Union{T, Generic.FracFieldElem{T}}) where T <: NfPoly composed=parent(x)(0) for (coeff, monomial) in zip(coefficients(x), monomials(x)) composed+=(evaluate(numerator(coeff), c)//evaluate(denominator(coeff), c))*monomial end return composed end -function setcongruence(x::Cyclo{T}, c::Union{T, Generic.Frac{T}}; simplify::Bool=true) where T <: NfPoly +function setcongruence(x::Cyclo{T}, c::Union{T, Generic.FracFieldElem{T}}; simplify::Bool=true) where T <: NfPoly Cyclo(x.modulus, setcongruence(x.argument, c), simplify=simplify) end -function setcongruence(x::CycloSum{T}, c::Union{T, Generic.Frac{T}}; simplify::Bool=true) where T <: NfPoly +function setcongruence(x::CycloSum{T}, c::Union{T, Generic.FracFieldElem{T}}; simplify::Bool=true) where T <: NfPoly summands=setcongruence.(x.summands, Ref(c)) CycloSum(summands, simplify=simplify) end -function setcongruence(x::CycloFrac{T}, c::Union{T, Generic.Frac{T}}; simplify::Bool=true) where T <: NfPoly +function setcongruence(x::CycloFrac{T}, c::Union{T, Generic.FracFieldElem{T}}; simplify::Bool=true) where T <: NfPoly CycloFrac(setcongruence(x.numerator, c), setcongruence(x.denominator, c), simplify=simplify) end -function setcongruence(x::ParameterException{T}, c::Union{T, Generic.Frac{T}}; simplify::Bool=true) where T <: NfPoly +function setcongruence(x::ParameterException{T}, c::Union{T, Generic.FracFieldElem{T}}; simplify::Bool=true) where T <: NfPoly ParameterException(setcongruence(x.expression, c), simplify=simplify) end """ - simplify(x::Union{Cyclotomic{T}, ParameterException{T}}, c::T, cinv::Generic.Frac{T}) where T <: NfPoly + simplify(x::Union{Cyclotomic{T}, ParameterException{T}}, c::T, cinv::Generic.FracFieldElem{T}) where T <: NfPoly Simplify `x` by replacing the generator of the polynomials of type `T` by `c` and then back to `cinv`. This is used to remove terms that look fractional but are in fact whole. """ -function simplify(x::Union{Cyclotomic{T}, ParameterException{T}}, c::T, cinv::Generic.Frac{T}) where T <: NfPoly +function simplify(x::Union{Cyclotomic{T}, ParameterException{T}}, c::T, cinv::Generic.FracFieldElem{T}) where T <: NfPoly setcongruence(setcongruence(x, c), cinv, simplify=false) end diff --git a/src/PrintToTex/Factor.jl b/src/PrintToTex/Factor.jl index 3c05833c..76efcd89 100644 --- a/src/PrintToTex/Factor.jl +++ b/src/PrintToTex/Factor.jl @@ -185,12 +185,12 @@ end Base.show(io::IO, z::ZetaFrac) = print(io, "($(z.numerator)) // ($(z.denominator))") Base.show(io::IO, m::MIME{Symbol("text/latex")}, z::ZetaFrac) = print(io, "\\frac{$(repr("text/latex", z.numerator))}{$(repr("text/latex",z.denominator))}") -function ordexp(b::Generic.Frac{QQPolyRingElem}) +function ordexp(b::Generic.FracFieldElem{QQPolyRingElem}) num, den = numerator(b), denominator(b) d = lcm(denominator.(collect(coefficients(num)))) return num*d, den*d end -function ordexp(b::Generic.Frac{Generic.Poly{nf_elem}}) +function ordexp(b::Generic.FracFieldElem{Generic.Poly{nf_elem}}) num, den = numerator(b), denominator(b) d = lcm(denominator.(coeff.(collect(coefficients(num)),0))) return num*d, den*d