Skip to content

Commit

Permalink
Add is_zero_initialized for FLINT backed matrix types (#1975)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored Dec 18, 2024
1 parent bf480c5 commit deb2b97
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[compat]
AbstractAlgebra = "0.44.0"
AbstractAlgebra = "0.44.1"
FLINT_jll = "^300.100.100"
Libdl = "1.6"
LinearAlgebra = "1.6"
Expand Down
1 change: 1 addition & 0 deletions src/Nemo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ import AbstractAlgebra: Group
import AbstractAlgebra: howell_form!
import AbstractAlgebra: Indent
import AbstractAlgebra: is_terse
import AbstractAlgebra: is_zero_initialized
import AbstractAlgebra: Lowercase
import AbstractAlgebra: LowercaseOff
import AbstractAlgebra: Module
Expand Down
2 changes: 2 additions & 0 deletions src/arb/ComplexMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ base_ring(a::ComplexMatrix) = ComplexField()

dense_matrix_type(::Type{ComplexFieldElem}) = ComplexMatrix

is_zero_initialized(::Type{ComplexMatrix}) = true

function getindex!(z::ComplexFieldElem, x::ComplexMatrix, r::Int, c::Int)
GC.@preserve x begin
v = mat_entry_ptr(x, r, c)
Expand Down
2 changes: 2 additions & 0 deletions src/arb/RealMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ base_ring(a::RealMatrix) = RealField()

dense_matrix_type(::Type{RealFieldElem}) = RealMatrix

is_zero_initialized(::Type{RealMatrix}) = true

function getindex!(z::ArbFieldElem, x::RealMatrix, r::Int, c::Int)
GC.@preserve x begin
v = mat_entry_ptr(x, r, c)
Expand Down
2 changes: 2 additions & 0 deletions src/arb/acb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ base_ring(a::AcbMatrix) = a.base_ring

dense_matrix_type(::Type{AcbFieldElem}) = AcbMatrix

is_zero_initialized(::Type{AcbMatrix}) = true

precision(x::AcbMatrixSpace) = precision(base_ring(x))

function getindex!(z::AcbFieldElem, x::AcbMatrix, r::Int, c::Int)
Expand Down
2 changes: 2 additions & 0 deletions src/arb/arb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ base_ring(a::ArbMatrix) = a.base_ring

dense_matrix_type(::Type{ArbFieldElem}) = ArbMatrix

is_zero_initialized(::Type{ArbMatrix}) = true

precision(x::ArbMatrixSpace) = precision(x.base_ring)

function getindex!(z::ArbFieldElem, x::ArbMatrix, r::Int, c::Int)
Expand Down
2 changes: 2 additions & 0 deletions src/flint/fmpq_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ base_ring(a::QQMatrix) = QQ

dense_matrix_type(::Type{QQFieldElem}) = QQMatrix

is_zero_initialized(::Type{QQMatrix}) = true

###############################################################################
#
# Similar & zero
Expand Down
2 changes: 2 additions & 0 deletions src/flint/fmpz_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ base_ring(a::ZZMatrix) = ZZ

dense_matrix_type(::Type{ZZRingElem}) = ZZMatrix

is_zero_initialized(::Type{ZZMatrix}) = true

###############################################################################
#
# similar & zero
Expand Down
2 changes: 2 additions & 0 deletions src/flint/fmpz_mod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

dense_matrix_type(::Type{ZZModRingElem}) = ZZModMatrix

is_zero_initialized(::Type{ZZModMatrix}) = true

###############################################################################
#
# Similar
Expand Down
2 changes: 2 additions & 0 deletions src/flint/fq_default_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

dense_matrix_type(::Type{FqFieldElem}) = FqMatrix

is_zero_initialized(::Type{FqMatrix}) = true

###############################################################################
#
# Similar & zero
Expand Down
2 changes: 2 additions & 0 deletions src/flint/fq_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

dense_matrix_type(::Type{FqPolyRepFieldElem}) = FqPolyRepMatrix

is_zero_initialized(::Type{FqPolyRepMatrix}) = true

###############################################################################
#
# Similar & zero
Expand Down
2 changes: 2 additions & 0 deletions src/flint/fq_nmod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

dense_matrix_type(::Type{fqPolyRepFieldElem}) = fqPolyRepMatrix

is_zero_initialized(::Type{fqPolyRepMatrix}) = true

###############################################################################
#
# Similar & zero
Expand Down
2 changes: 2 additions & 0 deletions src/flint/gfp_fmpz_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

dense_matrix_type(::Type{FpFieldElem}) = FpMatrix

is_zero_initialized(::Type{FpMatrix}) = true

###############################################################################
#
# Similar
Expand Down
2 changes: 2 additions & 0 deletions src/flint/gfp_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

dense_matrix_type(::Type{fpFieldElem}) = fpMatrix

is_zero_initialized(::Type{fpMatrix}) = true

###############################################################################
#
# Similar & zero
Expand Down
2 changes: 2 additions & 0 deletions src/flint/nmod_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

dense_matrix_type(::Type{zzModRingElem}) = zzModMatrix

is_zero_initialized(::Type{zzModMatrix}) = true

###############################################################################
#
# Similar & zero
Expand Down

0 comments on commit deb2b97

Please sign in to comment.