Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Oct 18, 2024
1 parent d2be9c1 commit 1950466
Showing 1 changed file with 8 additions and 40 deletions.
48 changes: 8 additions & 40 deletions src/flint/FlintTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1950466

Please sign in to comment.