Skip to content

Commit

Permalink
Use mat_entry_ptr in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jun 4, 2024
1 parent 7a5bac9 commit b34bd86
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 57 deletions.
12 changes: 5 additions & 7 deletions examples/NfMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -837,15 +837,13 @@ function Hecke.coeff(M::NfMatElem, i::Int)
return map(x->coeff(x, i), M)
end

function getindex_raw(M::QQMatrix, i::Int, j::Int)
return ccall((:fmpq_mat_entry, Nemo.libflint), Ptr{QQFieldElem}, (Ref{QQMatrix}, Int, Int), M, i-1, j-1)
end
getindex_raw(M::QQMatrix, i::Int, j::Int) = mat_entry_ptr(M, i, j)

function coeff!(m::QQMatrix, M::NfMatElem, n::Int)
K = base_ring(M)
for i=1:nrows(M)
for j=1:ncols(M)
ccall((:nf_elem_get_coeff_fmpq, Nemo.libantic), Cvoid, (Ptr{QQFieldElem}, Ptr{nf_elem_raw}, Int, Ref{AbsSimpleNumField}), getindex_raw(m, i, j), getindex_raw(M, i, j), n, K)
ccall((:nf_elem_get_coeff_fmpq, Nemo.libantic), Cvoid, (Ptr{QQFieldElem}, Ptr{nf_elem_raw}, Int, Ref{AbsSimpleNumField}), mat_entry_ptr(m, i, j), mat_entry_ptr(M, i, j), n, K)
end
end
end
Expand All @@ -865,7 +863,7 @@ function setcoeff!(M::NfMatElem, n::Int, m::QQMatrix)
@assert degree(K) > 2 #for now
for i=1:nrows(M)
for j=1:ncols(M)
ccall((:fmpq_poly_set_coeff_fmpq, Nemo.libflint), Cvoid, (Ptr{nf_elem_raw}, Int, Ptr{QQFieldElem}), getindex_raw(M, i, j), n, getindex_raw(m, i, j))
ccall((:fmpq_poly_set_coeff_fmpq, Nemo.libflint), Cvoid, (Ptr{nf_elem_raw}, Int, Ptr{QQFieldElem}), mat_entry_ptr(M, i, j), n, mat_entry_ptr(m, i, j))
end
end
end
Expand All @@ -874,7 +872,7 @@ function reduce!(M::NfMatElem)
K = base_ring(M)
for i=1:nrows(M)
for j=1:ncols(M)
reduce!(getindex_raw(M, i, j), K)
reduce!(mat_entry_ptr(M, i, j), K)
end
end
end
Expand Down Expand Up @@ -969,7 +967,7 @@ Hecke.number_of_columns(M::fmpz_poly_mat) = M.c

function Base.getindex(M::fmpz_poly_mat, i::Int, j::Int)
f = Hecke.Globals.Zx()
ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{fmpz_poly_raw}), f, getindex_raw(M, i, j))
ccall((:fmpz_poly_set, Nemo.libflint), Cvoid, (Ref{ZZPolyRingElem}, Ptr{fmpz_poly_raw}), f, mat_entry_ptr(M, i, j))
return f
end

Expand Down
6 changes: 3 additions & 3 deletions src/AlgAss/AlgGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ function __set_row!(y::QQMatrix, k, c)
GC.@preserve y
begin
for i in 1:length(c)
t = ccall((:fmpq_mat_entry, libflint), Ptr{QQFieldElem}, (Ref{QQMatrix}, Int, Int), y, k - 1, i - 1)
t = mat_entry_ptr(y, k, i)
ccall((:fmpq_set, libflint), Cvoid, (Ptr{QQFieldElem}, Ref{QQFieldElem}), t, c[i])
end
end
Expand All @@ -888,7 +888,7 @@ function __set_row!(c::Vector{QQFieldElem}, y::QQMatrix, k)
GC.@preserve y
begin
for i in 1:length(c)
t = ccall((:fmpq_mat_entry, libflint), Ptr{QQFieldElem}, (Ref{QQMatrix}, Int, Int), y, k - 1, i - 1)
t = mat_entry_ptr(y, k, i)
ccall((:fmpq_set, libflint), Cvoid, (Ref{QQFieldElem}, Ptr{QQFieldElem}), c[i], t)
end
end
Expand All @@ -897,7 +897,7 @@ end

function __set!(y, k, c)
GC.@preserve y begin
t = ccall((:fmpq_mat_entry, libflint), Ptr{QQFieldElem}, (Ref{QQMatrix}, Int, Int), y, 0, k - 1)
t = mat_entry_ptr(y, 1, k)
ccall((:fmpq_set, libflint), Cvoid, (Ptr{QQFieldElem}, Ref{QQFieldElem}), t, c)
end
nothing
Expand Down
2 changes: 1 addition & 1 deletion src/AlgAss/Elem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ function _addmul!(M::MatrixElem, i, j, b, c)
end

function _addmul!(M::QQMatrix, i, j, a::QQFieldElem, b::QQFieldElem)
c = ccall((:fmpq_mat_entry, libflint), Ptr{QQFieldElem}, (Ref{QQMatrix}, Int, Int), M, i - 1, j - 1)
c = mat_entry_ptr(M, i, j)
ccall((:fmpq_addmul, libflint), Nothing, (Ptr{QQFieldElem}, Ref{QQFieldElem}, Ref{QQFieldElem}), c, a, b)
end

Expand Down
2 changes: 1 addition & 1 deletion src/AlgAss/Map.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ end
function __set!(c_t::QQMatrix, ca)
GC.@preserve c_t begin
for i in 1:length(ca)
t = ccall((:fmpq_mat_entry, libflint), Ptr{QQFieldElem}, (Ref{QQMatrix}, Int, Int), c_t, 0, i - 1)
t = mat_entry_ptr(c_t, 1, i)
ccall((:fmpq_set, libflint), Cvoid, (Ptr{QQFieldElem}, Ref{QQFieldElem}), t, ca[i])
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/GrpAb/Elem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function reduce_mod_snf!(a::ZZMatrix, v::Vector{ZZRingElem})
d = v[i]
if !iszero(d)
for j = 1:nrows(a)
t = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), a, j - 1, i - 1)
t = mat_entry_ptr(a, j, i)
ccall((:fmpz_mod, libflint), Nothing, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), t, t, d)
end
#a[1, i] = mod(a[1, i], A.snf[i])
Expand Down
3 changes: 2 additions & 1 deletion src/Hecke.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ import Nemo: acb_struct, Ring, Group, Field, zzModRing, zzModRingElem, arf_struc
FpFieldElem, Zmodn_poly, Zmodn_mat, fpField,
FpField, acb_vec, array, acb_vec_clear, force_coerce,
force_op, fmpz_mod_ctx_struct, divisors, is_zero_entry, IntegerUnion, remove!,
valuation!, is_cyclo_type, is_embedded, is_maxreal_type
valuation!, is_cyclo_type, is_embedded, is_maxreal_type,
mat_entry_ptr

AbstractAlgebra.@include_deprecated_bindings()
Nemo.@include_deprecated_bindings()
Expand Down
36 changes: 16 additions & 20 deletions src/Misc/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ function reduce_mod_hnf_ur!(a::ZZMatrix, H::ZZMatrix)
if j > ncols(H)
break
end
n = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), a, c - 1, j - 1)
m = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), H, i - 1, j - 1)
n = mat_entry_ptr(a, c, j)
m = mat_entry_ptr(H, i, j)
q = ZZRingElem()
ccall((:fmpz_fdiv_q, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), q, n, m)
#q = fdiv(a[c, j], H[i, j])
Expand All @@ -248,8 +248,8 @@ function reduce_mod_hnf_ur!(a::ZZMatrix, H::ZZMatrix)
continue
end
for k = j:ncols(a)
t = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), a, c - 1, k - 1)
l = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), H, i - 1, k - 1)
t = mat_entry_ptr(a, c, k)
l = mat_entry_ptr(H, i, k)
ccall((:fmpz_submul, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), t, q, l)
#a[c, k] = a[c, k] - q * H[i, k]
end
Expand All @@ -270,8 +270,8 @@ function reduce_mod_hnf_ll!(a::ZZMatrix, H::ZZMatrix)
if iszero(j)
break
end
n = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), a, c - 1, j - 1)
m = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), H, i - 1, j - 1)
n = mat_entry_ptr(a, c, j)
m = mat_entry_ptr(H, i, j)
q = ZZRingElem()
ccall((:fmpz_fdiv_q, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), q, n, m)
#q = fdiv(a[c, j], H[i, j])
Expand All @@ -280,8 +280,8 @@ function reduce_mod_hnf_ll!(a::ZZMatrix, H::ZZMatrix)
continue
end
for k = 1:j
t = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), a, c - 1, k - 1)
l = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), H, i - 1, k - 1)
t = mat_entry_ptr(a, c, k)
l = mat_entry_ptr(H, i, k)
ccall((:fmpz_submul, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), t, q, l)
end
end
Expand Down Expand Up @@ -328,10 +328,8 @@ function _copy_matrix_into_matrix(A::ZZMatrix, i::Int, j::Int, B::ZZMatrix)
@GC.preserve A B begin
for k in 0:nrows(B) - 1
for l in 0:ncols(B) - 1
d = ccall((:fmpz_mat_entry, libflint),
Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), B, k, l)
t = ccall((:fmpz_mat_entry, libflint),
Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), A, i - 1 + k, j - 1 + l)
d = mat_entry_ptr(B, 1 + k, 1 + l)
t = mat_entry_ptr(A, i + k, j + l)
ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ptr{ZZRingElem}), t, d)
end
end
Expand All @@ -342,10 +340,8 @@ function _copy_matrix_into_matrix!(A::QQMatrix, i::Int, j::Int, B::QQMatrix)
@GC.preserve A B begin
for k in 0:nrows(B) - 1
for l in 0:ncols(B) - 1
d = ccall((:fmpq_mat_entry, libflint),
Ptr{QQFieldElem}, (Ref{QQMatrix}, Int, Int), B, k, l)
t = ccall((:fmpq_mat_entry, libflint),
Ptr{QQFieldElem}, (Ref{QQMatrix}, Int, Int), A, i - 1 + k, j - 1 + l)
d = mat_entry_ptr(B, 1 + k, 1 + l)
t = mat_entry_ptr(A, i + k, j + l)
ccall((:fmpq_set, libflint), Nothing, (Ptr{QQFieldElem}, Ptr{QQFieldElem}), t, d)
end
end
Expand Down Expand Up @@ -480,13 +476,13 @@ function snf_for_groups(A::ZZMatrix, mod::ZZRingElem)
#this is probably not really optimal...
GC.@preserve S R begin
for i=1:min(nrows(S), ncols(S))
Sii = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), S, i - 1, i - 1)
Sii = mat_entry_ptr(S, i, i)
fl = ccall((:fmpz_is_one, libflint), Bool, (Ref{ZZRingElem},), Sii)
if fl
continue
end
for j=i+1:min(nrows(S), ncols(S))
Sjj = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), S, j - 1, j - 1)
Sjj = mat_entry_ptr(S, j, j)
fl = ccall((:fmpz_is_zero, libflint), Bool, (Ref{ZZRingElem},), Sjj)
if fl
continue
Expand Down Expand Up @@ -524,8 +520,8 @@ function snf_for_groups(A::ZZMatrix, mod::ZZRingElem)
# so col i and j of R will be transformed. We do it naively
# careful: at this point, R is still transposed
for k = 1:nrows(R)
Rik = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), R, i - 1, k - 1)
Rjk = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), R, j - 1, k - 1)
Rik = mat_entry_ptr(R, i, k)
Rjk = mat_entry_ptr(R, j, k)
aux = ZZRingElem()
ccall((:fmpz_mul, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), aux, Rik, e)
ccall((:fmpz_addmul, libflint), Nothing, (Ref{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), aux, Rjk, f)
Expand Down
2 changes: 1 addition & 1 deletion src/NumFieldOrd/NfOrd/Ideal/TwoElement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function _assure_weakly_normal_presentation(A::AbsNumFieldOrderIdeal)

# Put the entries of B into the (1 x d)-Matrix m
for i in 1:degree(O)
s = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), m, 0, i - 1)
s = mat_entry_ptr(m, 1, i)
ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ref{ZZRingElem}), s, B[i])
end

Expand Down
2 changes: 1 addition & 1 deletion src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ function find_random_second_gen(A::AbsNumFieldOrderIdeal{S, T}) where {S, T}

# Put the entries of B into the (1 x d)-Matrix m
for i in 1:degree(O)
s = ccall((:fmpz_mat_entry, libflint), Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), m, 0, i - 1)
s = mat_entry_ptr(m, 1, i)
ccall((:fmpz_set, libflint), Nothing, (Ptr{ZZRingElem}, Ref{ZZRingElem}), s, B[i])
end
if iszero(m)
Expand Down
30 changes: 11 additions & 19 deletions src/QuadForm/LineOrbits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ function _isequal(x::fqPolyRepMatrix, y::Vector{fqPolyRepFieldElem})
R = base_ring(x)
@GC.preserve x begin
for i in 1:length(y)
el = ccall((:fq_nmod_mat_entry, libflint), Ptr{fqPolyRepFieldElem}, (Ref{fqPolyRepMatrix}, Int, Int), x, 0, i - 1)
el = mat_entry_ptr(x, 1, i)

Check warning on line 538 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L538

Added line #L538 was not covered by tests
b = ccall((:fq_nmod_equal, libflint), Cint, (Ref{fqPolyRepFieldElem}, Ptr{fqPolyRepFieldElem}, Ref{fqPolyRepField}), y[i], el, R)
bb = Bool(b)
if !bb
Expand All @@ -551,7 +551,7 @@ function _muleq!(x::fqPolyRepMatrix, y::fqPolyRepFieldElem)
@GC.preserve x begin
for i in 1:nrows(x)
for j in 1:ncols(x)
el = ccall((:fq_nmod_mat_entry, libflint), Ptr{fqPolyRepFieldElem}, (Ref{fqPolyRepMatrix}, Int, Int), x, i - 1, j - 1)
el = mat_entry_ptr(x, i, j)

Check warning on line 554 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L554

Added line #L554 was not covered by tests
ccall((:fq_nmod_mul, libflint), Cvoid, (Ptr{fqPolyRepFieldElem}, Ptr{fqPolyRepFieldElem}, Ref{fqPolyRepFieldElem}, Ref{fqPolyRepField}), el, el, y, R)
end
end
Expand All @@ -565,7 +565,7 @@ function _normalize!(x::fqPolyRepMatrix)
piv = 0
local ell
for j in 1:ncols(x)
el = ccall((:fq_nmod_mat_entry, libflint), Ptr{fqPolyRepFieldElem}, (Ref{fqPolyRepMatrix}, Int, Int), x, 0, j - 1)
el = mat_entry_ptr(x, 1, j)

Check warning on line 568 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L568

Added line #L568 was not covered by tests
b = ccall((:fq_nmod_is_zero, libflint), Cint, (Ptr{fqPolyRepFieldElem}, Ref{fqPolyRepField}), el, R)
if !Bool(b)
piv = j
Expand All @@ -578,8 +578,7 @@ function _normalize!(x::fqPolyRepMatrix)
@assert piv != 0

for j in (piv+1):ncols(x)
el = ccall((:fq_nmod_mat_entry, libflint), Ptr{fqPolyRepFieldElem},
(Ref{fqPolyRepMatrix}, Int, Int), x, 0, j - 1)
el = mat_entry_ptr(x, 1, j)

Check warning on line 581 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L581

Added line #L581 was not covered by tests
ccall((:fq_nmod_mul, libflint), Cvoid,
(Ptr{fqPolyRepFieldElem}, Ptr{fqPolyRepFieldElem}, Ref{fqPolyRepFieldElem}, Ref{fqPolyRepField}),
el, el, ell, R)
Expand Down Expand Up @@ -633,8 +632,7 @@ function _isless(x::Vector{fqPolyRepFieldElem}, y::fqPolyRepMatrix)
@GC.preserve y begin
for i in 1:d
xi = x[i]
el = ccall((:fq_nmod_mat_entry, libflint), Ptr{fqPolyRepFieldElem},
(Ref{fqPolyRepMatrix}, Int, Int), y, 0, i - 1)
el = mat_entry_ptr(y, 1, i)

Check warning on line 635 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L635

Added line #L635 was not covered by tests
b = ccall((:fq_nmod_equal, libflint), Cint,
(Ref{fqPolyRepFieldElem}, Ptr{fqPolyRepFieldElem}, Ref{fqPolyRepField}), xi, el, R)
if !Bool(b)
Expand All @@ -659,8 +657,7 @@ function _isequal(x::FqPolyRepMatrix, y::Vector{FqPolyRepFieldElem})
R = base_ring(x)
@GC.preserve x begin
for i in 1:length(y)
el = ccall((:fq_mat_entry, libflint), Ptr{FqPolyRepFieldElem},
(Ref{FqPolyRepMatrix}, Int, Int), x, 0, i - 1)
el = mat_entry_ptr(x, 1, i)

Check warning on line 660 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L660

Added line #L660 was not covered by tests
b = ccall((:fq_equal, libflint), Cint,
(Ref{FqPolyRepFieldElem}, Ptr{FqPolyRepFieldElem}, Ref{FqPolyRepField}), y[i], el, R)
bb = Bool(b)
Expand All @@ -677,8 +674,7 @@ function _muleq!(x::FqPolyRepMatrix, y::FqPolyRepFieldElem)
@GC.preserve x begin
for i in 1:nrows(x)
for j in 1:ncols(x)
el = ccall((:fq_mat_entry, libflint), Ptr{FqPolyRepFieldElem},
(Ref{FqPolyRepMatrix}, Int, Int), x, i - 1, j - 1)
el = mat_entry_ptr(x, i, j)

Check warning on line 677 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L677

Added line #L677 was not covered by tests
ccall((:fq_mul, libflint), Cvoid,
(Ptr{FqPolyRepFieldElem}, Ptr{FqPolyRepFieldElem}, Ref{FqPolyRepFieldElem}, Ref{FqPolyRepField}), el, el, y, R)
end
Expand All @@ -693,8 +689,7 @@ function _normalize!(x::FqPolyRepMatrix)
piv = 0
local ell
for j in 1:ncols(x)
el = ccall((:fq_mat_entry, libflint), Ptr{FqPolyRepFieldElem},
(Ref{FqPolyRepMatrix}, Int, Int), x, 0, j - 1)
el = mat_entry_ptr(x, 1, j)

Check warning on line 692 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L692

Added line #L692 was not covered by tests
b = ccall((:fq_is_zero, libflint), Cint,
(Ptr{FqPolyRepFieldElem}, Ref{FqPolyRepField}), el, R)
if !Bool(b)
Expand All @@ -709,8 +704,7 @@ function _normalize!(x::FqPolyRepMatrix)
@assert piv != 0

for j in (piv+1):ncols(x)
el = ccall((:fq_mat_entry, libflint), Ptr{FqPolyRepFieldElem},
(Ref{FqPolyRepMatrix}, Int, Int), x, 0, j - 1)
el = mat_entry_ptr(x, 1, j)

Check warning on line 707 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L707

Added line #L707 was not covered by tests
ccall((:fq_mul, libflint), Cvoid,
(Ptr{FqPolyRepFieldElem}, Ptr{FqPolyRepFieldElem}, Ref{FqPolyRepFieldElem}, Ref{FqPolyRepField}), el, el, ell, R)
end
Expand Down Expand Up @@ -767,8 +761,7 @@ function _isless(x::Vector{FqPolyRepFieldElem}, y::FqPolyRepMatrix, tx::ZZRingEl
@GC.preserve y begin
for i in 1:d
xi = x[i]
el = ccall((:fq_mat_entry, libflint), Ptr{FqPolyRepFieldElem},
(Ref{FqPolyRepMatrix}, Int, Int), y, 0, i - 1)
el = mat_entry_ptr(y, 1, i)

Check warning on line 764 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L764

Added line #L764 was not covered by tests
b = ccall((:fq_equal, libflint), Cint,
(Ref{FqPolyRepFieldElem}, Ptr{FqPolyRepFieldElem}, Ref{FqPolyRepField}), xi, el, R)
if !Bool(b)
Expand Down Expand Up @@ -800,8 +793,7 @@ function _isequal(x::FqMatrix, y::Vector{FqFieldElem})
R = base_ring(x)
@GC.preserve x begin
for i in 1:length(y)
el = ccall((:fq_mat_entry, libflint), Ptr{FqFieldElem},
(Ref{FqMatrix}, Int, Int), x, 0, i - 1)
el = mat_entry_ptr(x, 1, i)

Check warning on line 796 in src/QuadForm/LineOrbits.jl

View check run for this annotation

Codecov / codecov/patch

src/QuadForm/LineOrbits.jl#L796

Added line #L796 was not covered by tests
b = ccall((:fq_default_equal, libflint), Cint,
(Ref{FqFieldElem}, Ptr{FqFieldElem}, Ref{FqField}), y[i], el, R)
bb = Bool(b)
Expand Down
3 changes: 1 addition & 2 deletions src/Sparse/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ end
# GC.@preserve A block

@inline function _is_zero_entry(A::ZZMatrix, i, j)
x = ccall((:fmpz_mat_entry, libflint),
Ptr{ZZRingElem}, (Ref{ZZMatrix}, Int, Int), A, i - 1, j - 1)
x = mat_entry_ptr(A, i, j)
return ccall((:fmpz_is_zero, libflint), Bool, (Ptr{ZZRingElem},), x), x
end

Expand Down

0 comments on commit b34bd86

Please sign in to comment.