Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Oct 21, 2024
1 parent 701c58c commit 67df4ba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/flint/FlintTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ end
###############################################################################

mutable struct n_factor
num::Cint
exp::NTuple{15, Cint}
p::NTuple{15, UInt}
data::Flint.n_factor_t

function n_factor()
z = new()
Expand Down
4 changes: 2 additions & 2 deletions src/flint/fmpz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1621,11 +1621,11 @@ function _factor_trial_range(N::ZZRingElem, start::Int = 0, np::Int = 10^5)
ccall((:fmpz_factor_trial_range, libflint), Nothing,
(Ref{fmpz_factor}, Ref{ZZRingElem}, UInt, UInt), F, N, start, np)
res = Dict{ZZRingElem, Int}()
for i in 1:F.num
for i in 1:F.data.num
z = ZZRingElem()
ccall((:fmpz_factor_get_fmpz, libflint), Nothing,
(Ref{ZZRingElem}, Ref{fmpz_factor}, Int), z, F, i - 1)
res[z] = unsafe_load(F.exp, i)
res[z] = unsafe_load(F.data.exp, i)
end
return res, canonical_unit(N)
end
Expand Down
12 changes: 6 additions & 6 deletions src/flint/fmpz_factor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function _factor(a::ZZRingElem)
F = fmpz_factor()
ccall((:fmpz_factor, libflint), Nothing, (Ref{fmpz_factor}, Ref{ZZRingElem}), F, a)
res = Dict{ZZRingElem, Int}()
for i in 1:F.num
for i in 1:F.data.num
z = ZZRingElem()
ccall((:fmpz_factor_get_fmpz, libflint), Nothing,
(Ref{ZZRingElem}, Ref{fmpz_factor}, Int), z, F, i - 1)
Expand All @@ -25,9 +25,9 @@ function factor(a::T) where T <: Union{Int, UInt}
F = n_factor()
ccall((:n_factor, libflint), Nothing, (Ref{n_factor}, UInt), F, a)
res = Dict{T, Int}()
for i in 1:F.num
z = F.p[i]
res[z] = F.exp[i]
for i in 1:F.data.num
z = F.data.p[i]
res[z] = F.data.exp[i]
end
return Fac(u, res)
end
Expand Down Expand Up @@ -186,11 +186,11 @@ function factor_trial_range(N::ZZRingElem, start::Int=0, np::Int=10^5)
F = fmpz_factor()
ccall((:fmpz_factor_trial_range, libflint), Nothing, (Ref{fmpz_factor}, Ref{ZZRingElem}, UInt, UInt), F, N, start, np)
res = Dict{ZZRingElem,Int}()
for i in 1:F.num
for i in 1:F.data.num
z = ZZRingElem()
ccall((:fmpz_factor_get_fmpz, libflint), Nothing,
(Ref{ZZRingElem}, Ref{fmpz_factor}, Int), z, F, i - 1)
res[z] = unsafe_load(F.exp, i)
res[z] = unsafe_load(F.data.exp, i)
end
return res, canonical_unit(N)
end
4 changes: 2 additions & 2 deletions src/flint/fmpz_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,11 @@ for (factor_fn, factor_fn_inner, flint_fn) in
z = ZZRingElem()
ccall((:fmpz_poly_factor_get_fmpz, libflint), Nothing,
(Ref{ZZRingElem}, Ref{fmpz_poly_factor}), z, fac)
for i in 1:fac.num
for i in 1:fac.data.num
f = parent(x)()
ccall((:fmpz_poly_factor_get_fmpz_poly, libflint), Nothing,
(Ref{ZZPolyRingElem}, Ref{fmpz_poly_factor}, Int), f, fac, i - 1)
e = unsafe_load(fac.exp, i)
e = unsafe_load(fac.data.exp, i)
res[f] = e
end
return res, z
Expand Down

0 comments on commit 67df4ba

Please sign in to comment.