Skip to content

Commit

Permalink
Add fourth argument to setcoeff!
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Nov 8, 2024
1 parent 6f2d944 commit 3f86479
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 71 deletions.
34 changes: 16 additions & 18 deletions src/flint/FlintTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ mutable struct zzModPolyRingElem <: PolyRingElem{zzModRingElem}

function zzModPolyRingElem(n::UInt, a::Union{Integer,ZZRingElem,zzModRingElem})
z = zzModPolyRingElem(n)
setcoeff!(z, 0, a)
setcoeff!(z, 0, a, n)
return z
end

Expand All @@ -568,7 +568,7 @@ mutable struct zzModPolyRingElem <: PolyRingElem{zzModRingElem}
@ccall libflint.nmod_poly_init2(z::Ref{zzModPolyRingElem}, n::UInt, length(a)::Int)::Nothing
finalizer(_nmod_poly_clear_fn, z)
for i in 1:length(a)
setcoeff!(z, i - 1, a[i])
setcoeff!(z, i - 1, a[i], n)
end
return z
end
Expand Down Expand Up @@ -653,7 +653,7 @@ mutable struct fpPolyRingElem <: PolyRingElem{fpFieldElem}

function fpPolyRingElem(n::UInt, a::Union{Integer,ZZRingElem,fpFieldElem})
z = fpPolyRingElem(n)
setcoeff!(z, 0, a)
setcoeff!(z, 0, a, n)
return z
end

Expand All @@ -662,7 +662,7 @@ mutable struct fpPolyRingElem <: PolyRingElem{fpFieldElem}
@ccall libflint.nmod_poly_init2(z::Ref{fpPolyRingElem}, n::UInt, length(a)::Int)::Nothing
finalizer(_gfp_poly_clear_fn, z)
for i in 1:length(a)
setcoeff!(z, i - 1, a[i])
setcoeff!(z, i - 1, a[i], n)
end
return z
end
Expand Down Expand Up @@ -750,7 +750,7 @@ mutable struct ZZModPolyRingElem <: PolyRingElem{ZZModRingElem}

function ZZModPolyRingElem(n::fmpz_mod_ctx_struct, a::Union{Integer,ZZRingElem,ZZModRingElem})
z = ZZModPolyRingElem(n)
setcoeff!(z, 0, a)
setcoeff!(z, 0, a, n)
return z
end

Expand All @@ -759,11 +759,10 @@ mutable struct ZZModPolyRingElem <: PolyRingElem{ZZModRingElem}
end

function ZZModPolyRingElem(n::fmpz_mod_ctx_struct, a::Vector{<:Union{Integer,ZZRingElem,ZZModRingElem}})
length(a) == 0 && error("Array must have length > 0")
z = new()
@ccall libflint.fmpz_mod_poly_init2(z::Ref{ZZModPolyRingElem}, length(a)::Int, n::Ref{fmpz_mod_ctx_struct})::Nothing
for i in 1:length(a)
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], n)
end
finalizer(_fmpz_mod_poly_clear_fn, z)
return z
Expand Down Expand Up @@ -870,7 +869,7 @@ mutable struct FpPolyRingElem <: PolyRingElem{FpFieldElem}

function FpPolyRingElem(n::fmpz_mod_ctx_struct, a::Union{Integer,ZZRingElem,FpFieldElem})
z = FpPolyRingElem(n)
setcoeff!(z, 0, a)
setcoeff!(z, 0, a, n)
return z
end

Expand All @@ -883,11 +882,10 @@ mutable struct FpPolyRingElem <: PolyRingElem{FpFieldElem}
end

function FpPolyRingElem(n::fmpz_mod_ctx_struct, a::Vector{<:Union{Integer,ZZRingElem,FpFieldElem}})
length(a) == 0 && error("Array must have length > 0")
z = new()
@ccall libflint.fmpz_mod_poly_init2(z::Ref{FpPolyRingElem}, length(a)::Int, n::Ref{fmpz_mod_ctx_struct})::Nothing
for i in 1:length(a)
setcoeff!(z, i - 1, a[i])
setcoeff!(z, i - 1, a[i], n)
end
finalizer(_fmpz_mod_poly_clear_fn, z)
return z
Expand Down Expand Up @@ -2869,7 +2867,7 @@ mutable struct fpRelPowerSeriesRingElem <: RelPowerSeriesRingElem{fpFieldElem}
z = new()
@ccall libflint.nmod_poly_init2(z::Ref{fpRelPowerSeriesRingElem}, p::UInt, len::Int)::Nothing
for i in 1:len
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], p)
end
z.prec = prec
z.val = val
Expand Down Expand Up @@ -2936,7 +2934,7 @@ mutable struct zzModRelPowerSeriesRingElem <: RelPowerSeriesRingElem{zzModRingEl
z = new()
@ccall libflint.nmod_poly_init2(z::Ref{zzModRelPowerSeriesRingElem}, p::UInt, len::Int)::Nothing
for i in 1:len
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], p)
end
z.prec = prec
z.val = val
Expand Down Expand Up @@ -3007,7 +3005,7 @@ mutable struct FpRelPowerSeriesRingElem <: RelPowerSeriesRingElem{FpFieldElem}
z = new()
@ccall libflint.fmpz_mod_poly_init2(z::Ref{FpRelPowerSeriesRingElem}, len::Int, p::Ref{fmpz_mod_ctx_struct})::Nothing
for i in 1:len
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], p)
end
z.prec = prec
z.val = val
Expand Down Expand Up @@ -3085,7 +3083,7 @@ mutable struct ZZModRelPowerSeriesRingElem <: RelPowerSeriesRingElem{ZZModRingEl
z = new()
@ccall libflint.fmpz_mod_poly_init2(z::Ref{ZZModRelPowerSeriesRingElem}, len::Int, p::Ref{fmpz_mod_ctx_struct})::Nothing
for i in 1:len
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], p)
end
z.prec = prec
z.val = val
Expand Down Expand Up @@ -3162,7 +3160,7 @@ mutable struct FpAbsPowerSeriesRingElem <: AbsPowerSeriesRingElem{FpFieldElem}
z = new()
@ccall libflint.fmpz_mod_poly_init2(z::Ref{FpAbsPowerSeriesRingElem}, len::Int, p::Ref{fmpz_mod_ctx_struct})::Nothing
for i in 1:len
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], p)
end
z.prec = prec
finalizer(_gfp_fmpz_abs_series_clear_fn, z)
Expand Down Expand Up @@ -3235,7 +3233,7 @@ mutable struct zzModAbsPowerSeriesRingElem <: AbsPowerSeriesRingElem{zzModRingEl
z = new()
@ccall libflint.nmod_poly_init2(z::Ref{zzModAbsPowerSeriesRingElem}, n::UInt, length(a)::Int)::Nothing
for i in 1:len
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], n)
end
z.prec = prec
finalizer(_nmod_abs_series_clear_fn, z)
Expand Down Expand Up @@ -3304,7 +3302,7 @@ mutable struct fpAbsPowerSeriesRingElem <: AbsPowerSeriesRingElem{fpFieldElem}
z = new()
@ccall libflint.nmod_poly_init2(z::Ref{fpAbsPowerSeriesRingElem}, n::UInt, length(a)::Int)::Nothing
for i in 1:len
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], n)
end
z.prec = prec
finalizer(_gfp_abs_series_clear_fn, z)
Expand Down Expand Up @@ -3373,7 +3371,7 @@ mutable struct ZZModAbsPowerSeriesRingElem <: AbsPowerSeriesRingElem{ZZModRingEl
z = new()
@ccall libflint.fmpz_mod_poly_init2(z::Ref{ZZModAbsPowerSeriesRingElem}, len::Int, p::Ref{fmpz_mod_ctx_struct})::Nothing
for i in 1:len
setcoeff!(z, i-1, a[i])
setcoeff!(z, i-1, a[i], p)
end
z.prec = prec
finalizer(_fmpz_mod_abs_series_clear_fn, z)
Expand Down
16 changes: 8 additions & 8 deletions src/flint/fmpz_mod_abs_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -496,23 +496,23 @@ for (etype, rtype, ctype, mtype, brtype) in (
return nothing
end

function setcoeff!(z::($etype), n::Int, x::ZZRingElemOrPtr)
@ccall libflint.fmpz_mod_poly_set_coeff_fmpz(z::Ref{($etype)}, n::Int, x::Ref{ZZRingElem}, base_ring(z).ninv::Ref{($ctype)})::Nothing
function setcoeff!(z::($etype), i::Int, x::ZZRingElemOrPtr, ctx::($ctype)=base_ring(z).ninv)
@ccall libflint.fmpz_mod_poly_set_coeff_fmpz(z::Ref{($etype)}, i::Int, x::Ref{ZZRingElem}, ctx::Ref{($ctype)})::Nothing
return z
end

function setcoeff!(z::($etype), n::Int, x::UInt)
@ccall libflint.fmpz_mod_poly_set_coeff_ui(z::Ref{($etype)}, n::Int, x::UInt, base_ring(z).ninv::Ref{($ctype)})::Nothing
function setcoeff!(z::($etype), i::Int, x::UInt, ctx::($ctype)=base_ring(z).ninv)
@ccall libflint.fmpz_mod_poly_set_coeff_ui(z::Ref{($etype)}, i::Int, x::UInt, ctx::Ref{($ctype)})::Nothing
return z

Check warning on line 506 in src/flint/fmpz_mod_abs_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz_mod_abs_series.jl#L504-L506

Added lines #L504 - L506 were not covered by tests
end

function setcoeff!(z::($etype), n::Int, x::Int)
@ccall libflint.fmpz_mod_poly_set_coeff_si(z::Ref{($etype)}, n::Int, x::UInt, base_ring(z).ninv::Ref{($ctype)})::Nothing
function setcoeff!(z::($etype), i::Int, x::Int, ctx::($ctype)=base_ring(z).ninv)
@ccall libflint.fmpz_mod_poly_set_coeff_si(z::Ref{($etype)}, i::Int, x::UInt, ctx::Ref{($ctype)})::Nothing

Check warning on line 510 in src/flint/fmpz_mod_abs_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz_mod_abs_series.jl#L509-L510

Added lines #L509 - L510 were not covered by tests
end

setcoeff!(z::($etype), n::Int, x::Integer) = setcoeff!(z, n, flintify(x))
setcoeff!(z::($etype), i::Int, x::Integer, ctx::($ctype)=base_ring(z).ninv) = setcoeff!(z, i, flintify(x), ctx)

Check warning on line 513 in src/flint/fmpz_mod_abs_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz_mod_abs_series.jl#L513

Added line #L513 was not covered by tests

setcoeff!(z::($etype), n::Int, x::($mtype)) = setcoeff!(z, n, data(x))
setcoeff!(z::($etype), i::Int, x::($mtype), ctx::($ctype)=base_ring(z).ninv) = setcoeff!(z, i, data(x), ctx)

function mul!(z::($etype), a::($etype), b::($etype))
lena = length(a)
Expand Down
16 changes: 8 additions & 8 deletions src/flint/fmpz_mod_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -779,23 +779,23 @@ end

#

function setcoeff!(z::T, n::Int, x::ZZRingElemOrPtr) where T <: Zmodn_fmpz_poly
@ccall libflint.fmpz_mod_poly_set_coeff_fmpz(z::Ref{T}, n::Int, x::Ref{ZZRingElem}, base_ring(z).ninv::Ref{fmpz_mod_ctx_struct})::Nothing
function setcoeff!(z::T, i::Int, x::ZZRingElemOrPtr, ctx::fmpz_mod_ctx_struct=base_ring(z).ninv) where T <: Zmodn_fmpz_poly
@ccall libflint.fmpz_mod_poly_set_coeff_fmpz(z::Ref{T}, i::Int, x::Ref{ZZRingElem}, ctx::Ref{fmpz_mod_ctx_struct})::Nothing
return z
end

function setcoeff!(z::T, n::Int, x::UInt) where T <: Zmodn_fmpz_poly
@ccall libflint.fmpz_mod_poly_set_coeff_ui(z::Ref{T}, n::Int, x::UInt, base_ring(z).ninv::Ref{fmpz_mod_ctx_struct})::Nothing
function setcoeff!(z::T, i::Int, x::UInt, ctx::fmpz_mod_ctx_struct=base_ring(z).ninv) where T <: Zmodn_fmpz_poly
@ccall libflint.fmpz_mod_poly_set_coeff_ui(z::Ref{T}, i::Int, x::UInt, ctx::Ref{fmpz_mod_ctx_struct})::Nothing
return z
end

function setcoeff!(z::T, n::Int, x::Int) where T <: Zmodn_fmpz_poly
@ccall libflint.fmpz_mod_poly_set_coeff_si(z::Ref{T}, n::Int, x::UInt, base_ring(z).ninv::Ref{fmpz_mod_ctx_struct})::Nothing
function setcoeff!(z::T, i::Int, x::Int, ctx::fmpz_mod_ctx_struct=base_ring(z).ninv) where T <: Zmodn_fmpz_poly
@ccall libflint.fmpz_mod_poly_set_coeff_si(z::Ref{T}, i::Int, x::UInt, ctx::Ref{fmpz_mod_ctx_struct})::Nothing
end

setcoeff!(z::T, n::Int, x::Integer) where T <: Zmodn_fmpz_poly = setcoeff!(z, n, flintify(x))
setcoeff!(z::T, i::Int, x::Integer, ctx::fmpz_mod_ctx_struct=base_ring(z).ninv) where T <: Zmodn_fmpz_poly = setcoeff!(z, i, flintify(x), ctx)

Check warning on line 796 in src/flint/fmpz_mod_poly.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz_mod_poly.jl#L796

Added line #L796 was not covered by tests

setcoeff!(z::ZZModPolyRingElem, n::Int, x::ZZModRingElem) = setcoeff!(z, n, data(x))
setcoeff!(z::ZZModPolyRingElem, i::Int, x::ZZModRingElem, ctx::fmpz_mod_ctx_struct=base_ring(z).ninv) = setcoeff!(z, i, data(x), ctx)

#

Expand Down
16 changes: 8 additions & 8 deletions src/flint/fmpz_mod_rel_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -599,23 +599,23 @@ for (etype, rtype, ctype, mtype, brtype) in (
return nothing
end

function setcoeff!(z::($etype), n::Int, x::ZZRingElemOrPtr)
@ccall libflint.fmpz_mod_poly_set_coeff_fmpz(z::Ref{($etype)}, n::Int, x::Ref{ZZRingElem}, base_ring(z).ninv::Ref{($ctype)})::Nothing
function setcoeff!(z::($etype), i::Int, x::ZZRingElemOrPtr, ctx::($ctype)=base_ring(z).ninv)
@ccall libflint.fmpz_mod_poly_set_coeff_fmpz(z::Ref{($etype)}, i::Int, x::Ref{ZZRingElem}, ctx::Ref{($ctype)})::Nothing
return z
end

function setcoeff!(z::($etype), n::Int, x::UInt)
@ccall libflint.fmpz_mod_poly_set_coeff_ui(z::Ref{($etype)}, n::Int, x::UInt, base_ring(z).ninv::Ref{($ctype)})::Nothing
function setcoeff!(z::($etype), i::Int, x::UInt, ctx::($ctype)=base_ring(z).ninv)
@ccall libflint.fmpz_mod_poly_set_coeff_ui(z::Ref{($etype)}, i::Int, x::UInt, ctx::Ref{($ctype)})::Nothing

Check warning on line 608 in src/flint/fmpz_mod_rel_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz_mod_rel_series.jl#L607-L608

Added lines #L607 - L608 were not covered by tests
return z
end

function setcoeff!(z::($etype), n::Int, x::Int)
@ccall libflint.fmpz_mod_poly_set_coeff_si(z::Ref{($etype)}, n::Int, x::UInt, base_ring(z).ninv::Ref{($ctype)})::Nothing
function setcoeff!(z::($etype), i::Int, x::Int, ctx::($ctype)=base_ring(z).ninv)
@ccall libflint.fmpz_mod_poly_set_coeff_si(z::Ref{($etype)}, i::Int, x::UInt, ctx::Ref{($ctype)})::Nothing

Check warning on line 613 in src/flint/fmpz_mod_rel_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz_mod_rel_series.jl#L612-L613

Added lines #L612 - L613 were not covered by tests
end

setcoeff!(z::($etype), n::Int, x::Integer) = setcoeff!(z, n, flintify(x))
setcoeff!(z::($etype), i::Int, x::Integer, ctx::($ctype)=base_ring(z).ninv) = setcoeff!(z, i, flintify(x), ctx)

Check warning on line 616 in src/flint/fmpz_mod_rel_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz_mod_rel_series.jl#L616

Added line #L616 was not covered by tests

setcoeff!(z::($etype), n::Int, x::($mtype)) = setcoeff!(z, n, data(x))
setcoeff!(z::($etype), i::Int, x::($mtype), ctx::($ctype)=base_ring(z).ninv) = setcoeff!(z, i, data(x), ctx)

function mul!(z::($etype), a::($etype), b::($etype))
lena = pol_length(a)
Expand Down
2 changes: 1 addition & 1 deletion src/flint/gfp_fmpz_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ end
#
################################################################################

setcoeff!(z::FpPolyRingElem, n::Int, x::FpFieldElem) = setcoeff!(z, n, data(x))
setcoeff!(z::FpPolyRingElem, i::Int, x::FpFieldElem, ctx::fmpz_mod_ctx_struct=base_ring(z).ninv) = setcoeff!(z, i, data(x), ctx)

################################################################################
#
Expand Down
2 changes: 1 addition & 1 deletion src/flint/gfp_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ end
#
################################################################################

setcoeff!(z::fpPolyRingElem, n::Int, x::fpFieldElem) = setcoeff!(z, n, data(x))
setcoeff!(z::fpPolyRingElem, i::Int, x::fpFieldElem, n::UInt=modulus(z)) = setcoeff!(z, i, data(x), n)

################################################################################
#
Expand Down
18 changes: 9 additions & 9 deletions src/flint/nmod_abs_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -484,23 +484,23 @@ for (etype, rtype, mtype, brtype) in (
return nothing
end

function setcoeff!(z::($etype), n::Int, x::UInt)
@ccall libflint.nmod_poly_set_coeff_ui(z::Ref{($etype)}, n::Int, x::UInt)::Nothing
function setcoeff!(z::($etype), i::Int, x::UInt, n::UInt=modulus(z))
@ccall libflint.nmod_poly_set_coeff_ui(z::Ref{($etype)}, i::Int, x::UInt)::Nothing
return z
end

function setcoeff!(z::($etype), n::Int, x::Int)
return setcoeff!(z, n, mod(x, modulus(z)))
function setcoeff!(z::($etype), i::Int, x::Int, n::UInt=modulus(z))
return setcoeff!(z, i, mod(x, n), n)

Check warning on line 493 in src/flint/nmod_abs_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/nmod_abs_series.jl#L492-L493

Added lines #L492 - L493 were not covered by tests
end

function setcoeff!(z::($etype), n::Int, x::ZZRingElem)
xx = ccall((:fmpz_fdiv_ui, libflint), UInt, (Ref{ZZRingElem}, UInt), x, modulus(z))
return setcoeff!(z, n, xx)
function setcoeff!(z::($etype), i::Int, x::ZZRingElem, n::UInt=modulus(z))
xx = @ccall libflint.fmpz_fdiv_ui(x::Ref{ZZRingElem}, n::UInt)::UInt
return setcoeff!(z, i, xx, n)
end

setcoeff!(z::($etype), n::Int, x::Integer) = setcoeff!(z, n, flintify(x))
setcoeff!(z::($etype), i::Int, x::Integer, n::UInt=modulus(z)) = setcoeff!(z, i, flintify(x), n)

Check warning on line 501 in src/flint/nmod_abs_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/nmod_abs_series.jl#L501

Added line #L501 was not covered by tests

setcoeff!(z::($etype), n::Int, x::($mtype)) = setcoeff!(z, n, data(x))
setcoeff!(z::($etype), i::Int, x::($mtype), n::UInt=modulus(z)) = setcoeff!(z, i, data(x), n)

function mul!(z::($etype), a::($etype), b::($etype))
lena = length(a)
Expand Down
18 changes: 9 additions & 9 deletions src/flint/nmod_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -846,23 +846,23 @@ end

#

function setcoeff!(z::T, n::Int, x::UInt) where T <: Zmodn_poly
@ccall libflint.nmod_poly_set_coeff_ui(z::Ref{T}, n::Int, x::UInt)::Nothing
function setcoeff!(z::T, i::Int, x::UInt, n::UInt=modulus(z)) where T <: Zmodn_poly
@ccall libflint.nmod_poly_set_coeff_ui(z::Ref{T}, i::Int, x::UInt)::Nothing
return z
end

function setcoeff!(z::T, n::Int, x::Int) where T <: Zmodn_poly
return setcoeff!(z, n, mod(x, modulus(z)))
function setcoeff!(z::T, i::Int, x::Int, n::UInt=modulus(z)) where T <: Zmodn_poly
return setcoeff!(z, i, mod(x, n), n)
end

function setcoeff!(z::T, n::Int, x::ZZRingElem) where T <: Zmodn_poly
xx = ccall((:fmpz_fdiv_ui, libflint), UInt, (Ref{ZZRingElem}, UInt), x, modulus(z))
return setcoeff!(z, n, xx)
function setcoeff!(z::T, i::Int, x::ZZRingElem, n::UInt=modulus(z)) where T <: Zmodn_poly
xx = ccall((:fmpz_fdiv_ui, libflint), UInt, (Ref{ZZRingElem}, UInt), x, n)
return setcoeff!(z, i, xx, n)
end

setcoeff!(z::T, n::Int, x::Integer) where T <: Zmodn_poly = setcoeff!(z, n, flintify(x))
setcoeff!(z::T, i::Int, x::Integer, n::UInt=modulus(z)) where T <: Zmodn_poly = setcoeff!(z, i, flintify(x), n)

setcoeff!(z::zzModPolyRingElem, n::Int, x::zzModRingElem) = setcoeff!(z, n, data(x))
setcoeff!(z::zzModPolyRingElem, i::Int, x::zzModRingElem, n::UInt=modulus(z)) = setcoeff!(z, i, data(x), n)

#

Expand Down
18 changes: 9 additions & 9 deletions src/flint/nmod_rel_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -641,23 +641,23 @@ for (etype, rtype, mtype, brtype) in (
return nothing
end

function setcoeff!(z::($etype), n::Int, x::UInt)
@ccall libflint.nmod_poly_set_coeff_ui(z::Ref{($etype)}, n::Int, x::UInt)::Nothing
function setcoeff!(z::($etype), i::Int, x::UInt, n::UInt=modulus(z))
@ccall libflint.nmod_poly_set_coeff_ui(z::Ref{($etype)}, i::Int, x::UInt)::Nothing
return z
end

function setcoeff!(z::($etype), n::Int, x::Int)
return setcoeff!(z, n, mod(x, modulus(z)))
function setcoeff!(z::($etype), i::Int, x::Int, n::UInt=modulus(z))
return setcoeff!(z, i, mod(x, n), n)

Check warning on line 650 in src/flint/nmod_rel_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/nmod_rel_series.jl#L649-L650

Added lines #L649 - L650 were not covered by tests
end

function setcoeff!(z::($etype), n::Int, x::ZZRingElem)
xx = @ccall libflint.fmpz_fdiv_ui(x::Ref{ZZRingElem}, modulus(z)::UInt)::UInt
return setcoeff!(z, n, xx)
function setcoeff!(z::($etype), i::Int, x::ZZRingElem, n::UInt=modulus(z))
xx = @ccall libflint.fmpz_fdiv_ui(x::Ref{ZZRingElem}, n::UInt)::UInt
return setcoeff!(z, i, xx, n)
end

setcoeff!(z::($etype), n::Int, x::Integer) = setcoeff!(z, n, flintify(x))
setcoeff!(z::($etype), i::Int, x::Integer, n::UInt=modulus(z)) = setcoeff!(z, i, flintify(x), n)

Check warning on line 658 in src/flint/nmod_rel_series.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/nmod_rel_series.jl#L658

Added line #L658 was not covered by tests

setcoeff!(z::($etype), n::Int, x::($mtype)) = setcoeff!(z, n, data(x))
setcoeff!(z::($etype), i::Int, x::($mtype), n::UInt=modulus(z)) = setcoeff!(z, i, data(x), n)

function mul!(z::($etype), a::($etype), b::($etype))
lena = pol_length(a)
Expand Down

0 comments on commit 3f86479

Please sign in to comment.