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 a17f5c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 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

0 comments on commit a17f5c2

Please sign in to comment.