From a17f5c2eb18fff4efaaf9097f66c64330b5cafa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Mon, 21 Oct 2024 17:12:44 +0200 Subject: [PATCH] some fixes --- src/flint/FlintTypes.jl | 4 +--- src/flint/fmpz.jl | 4 ++-- src/flint/fmpz_factor.jl | 12 ++++++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/flint/FlintTypes.jl b/src/flint/FlintTypes.jl index 84d2c6ef0..67bdb7007 100644 --- a/src/flint/FlintTypes.jl +++ b/src/flint/FlintTypes.jl @@ -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() diff --git a/src/flint/fmpz.jl b/src/flint/fmpz.jl index 889871d7b..58a6303d0 100644 --- a/src/flint/fmpz.jl +++ b/src/flint/fmpz.jl @@ -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 diff --git a/src/flint/fmpz_factor.jl b/src/flint/fmpz_factor.jl index e446c44c4..db57b6233 100644 --- a/src/flint/fmpz_factor.jl +++ b/src/flint/fmpz_factor.jl @@ -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) @@ -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 @@ -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