Skip to content

Commit

Permalink
Move more code out of src/Hecke*.jl (#1804)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored Jun 27, 2024
1 parent f44f726 commit 03e705a
Show file tree
Hide file tree
Showing 19 changed files with 329 additions and 319 deletions.
2 changes: 0 additions & 2 deletions src/HeckeMiscInteger.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
clog(a::Int, b::Int) = clog(ZZRingElem(a), b)

function Float64(a::QQFieldElem)
b = a * ZZRingElem(2)^53
Float64(div(numerator(b), denominator(b))) / (Float64(2)^53) #CF 2^53 is bad in 32bit
Expand Down
55 changes: 0 additions & 55 deletions src/HeckeMiscMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,61 +29,6 @@ function Array(a::ZZMatrix; S::Type{T}=ZZRingElem) where {T}
return A
end

################################################################################
#
################################################################################

function maximum(f::typeof(abs), a::ZZMatrix)
r = ZZRingElem()
GC.@preserve a r begin
m = mat_entry_ptr(a, 1, 1)
for i = 1:nrows(a)
for j = 1:ncols(a)
z = mat_entry_ptr(a, i, j)
if ccall((:fmpz_cmpabs, libflint), Cint, (Ptr{ZZRingElem}, Ptr{ZZRingElem}), m, z) < 0
m = z
end
end
end
ccall((:fmpz_abs, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}), r, m)
end
return r
end

function maximum(a::ZZMatrix)
r = ZZRingElem()
GC.@preserve a r begin
m = mat_entry_ptr(a, 1, 1)
for i = 1:nrows(a)
for j = 1:ncols(a)
z = mat_entry_ptr(a, i, j)
if ccall((:fmpz_cmp, libflint), Cint, (Ptr{ZZRingElem}, Ptr{ZZRingElem}), m, z) < 0
m = z
end
end
end
set!(r, m)
end
return r
end

function minimum(a::ZZMatrix)
r = ZZRingElem()
GC.@preserve a r begin
m = mat_entry_ptr(a, 1, 1)
for i = 1:nrows(a)
for j = 1:ncols(a)
z = mat_entry_ptr(a, i, j)
if ccall((:fmpz_cmp, libflint), Cint, (Ptr{ZZRingElem}, Ptr{ZZRingElem}), m, z) > 0
m = z
end
end
end
set!(r, m)
end
return r
end

################################################################################
#
# Lift of matrices to overrings
Expand Down
Loading

0 comments on commit 03e705a

Please sign in to comment.