From 19504660307035f89d3442047a28e6ddd471cb1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 18 Oct 2024 20:57:16 +0200 Subject: [PATCH] more cleanup --- src/flint/FlintTypes.jl | 48 +++++++---------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/src/flint/FlintTypes.jl b/src/flint/FlintTypes.jl index 9199983fc..69d9e20f9 100644 --- a/src/flint/FlintTypes.jl +++ b/src/flint/FlintTypes.jl @@ -563,16 +563,12 @@ mutable struct zzModPolyRingElem <: PolyRingElem{zzModRingElem} return z end - function zzModPolyRingElem(n::UInt, a::UInt) + function zzModPolyRingElem(n::UInt, a::Union{Integer,ZZRingElem,zzModRingElem}) z = zzModPolyRingElem(n) setcoeff!(z, 0, a) return z end - function zzModPolyRingElem(n::UInt, a::Integer) - return zzModPolyRingElem(n, mod(a, n) % UInt) - end - function zzModPolyRingElem(n::UInt, a::Vector{<:Union{Integer,ZZRingElem,zzModRingElem}}) z = new() ccall((:nmod_poly_init2, libflint), Nothing, @@ -668,16 +664,12 @@ mutable struct fpPolyRingElem <: PolyRingElem{fpFieldElem} return z end - function fpPolyRingElem(n::UInt, a::UInt) + function fpPolyRingElem(n::UInt, a::Union{Integer,ZZRingElem,fpFieldElem}) z = fpPolyRingElem(n) setcoeff!(z, 0, a) return z end - function fpPolyRingElem(n::UInt, a::Integer) - return fpPolyRingElem(n, mod(a, n) % UInt) - end - function fpPolyRingElem(n::UInt, arr::Vector{<:Union{Integer,ZZRingElem,fpFieldElem}}) z = new() ccall((:nmod_poly_init2, libflint), Nothing, @@ -778,27 +770,13 @@ mutable struct ZZModPolyRingElem <: PolyRingElem{ZZModRingElem} return ZZModPolyRingElem(R.ninv) end - function ZZModPolyRingElem(n::fmpz_mod_ctx_struct, a::ZZRingElem) + function ZZModPolyRingElem(n::fmpz_mod_ctx_struct, a::Union{Integer,ZZRingElem,ZZModRingElem}) z = ZZModPolyRingElem(n) - ccall((:fmpz_mod_poly_set_coeff_fmpz, libflint), Nothing, - (Ref{ZZModPolyRingElem}, Int, Ref{ZZRingElem}, Ref{fmpz_mod_ctx_struct}), - z, 0, a, n) - return z - end - - function ZZModPolyRingElem(R::ZZModRing, a::ZZRingElem) - return ZZModPolyRingElem(R.ninv, a) - end - - function ZZModPolyRingElem(n::fmpz_mod_ctx_struct, a::UInt) - z = ZZModPolyRingElem(n) - ccall((:fmpz_mod_poly_set_coeff_ui, libflint), Nothing, - (Ref{ZZModPolyRingElem}, Int, UInt, Ref{fmpz_mod_ctx_struct}), - z, 0, a, n) + setcoeff!(z, 0, a) return z end - function ZZModPolyRingElem(R::ZZModRing, a::UInt) + function ZZModPolyRingElem(R::ZZModRing, a::Union{Integer,ZZRingElem,ZZModRingElem}) return ZZModPolyRingElem(R.ninv, a) end @@ -930,26 +908,16 @@ mutable struct FpPolyRingElem <: PolyRingElem{FpFieldElem} return FpPolyRingElem(R.ninv) end - function FpPolyRingElem(n::fmpz_mod_ctx_struct, a::ZZRingElem) + function FpPolyRingElem(n::fmpz_mod_ctx_struct, a::Union{Integer,ZZRingElem,FpFieldElem}) z = FpPolyRingElem(n) - ccall((:fmpz_mod_poly_set_coeff_fmpz, libflint), Nothing, - (Ref{FpPolyRingElem}, Int, Ref{ZZRingElem}, Ref{fmpz_mod_ctx_struct}), - z, 0, a, n) + setcoeff!(z, 0, a) return z end - function FpPolyRingElem(R::FpField, a::ZZRingElem) + function FpPolyRingElem(R::FpField, a::Union{Integer,ZZRingElem,FpFieldElem}) return FpPolyRingElem(R.ninv, a) end - function FpPolyRingElem(n::fmpz_mod_ctx_struct, a::UInt) - z = FpPolyRingElem(n) - ccall((:fmpz_mod_poly_set_coeff_ui, libflint), Nothing, - (Ref{FpPolyRingElem}, Int, UInt, Ref{fmpz_mod_ctx_struct}), - z, 0, a, n) - return z - end - function FpPolyRingElem(R::FpField, a::UInt) return FpPolyRingElem(R.ninv, a) end