Skip to content

Commit

Permalink
Make dim check in matrix space creation consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Apr 24, 2024
1 parent 22e3908 commit a837dca
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/arb/ArbTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ struct RealMatSpace <: MatSpace{RealFieldElem}
ncols::Int

function RealMatSpace(R::RealField, r::Int, c::Int)
(r < 0 || c < 0) && throw(_err_dim_negative)
return new(r, c)
end
end
Expand Down Expand Up @@ -995,6 +996,7 @@ struct ArbMatSpace <: MatSpace{ArbFieldElem}
base_ring::ArbField

function ArbMatSpace(R::ArbField, r::Int, c::Int)
(r < 0 || c < 0) && throw(_err_dim_negative)
return new(r, c, R)
end
end
Expand Down Expand Up @@ -1122,6 +1124,7 @@ struct ComplexMatSpace <: MatSpace{ComplexFieldElem}
#base_ring::AcbField

function ComplexMatSpace(R::ComplexField, r::Int, c::Int)
(r < 0 || c < 0) && throw(_err_dim_negative)
return new(r, c)
end
end
Expand Down Expand Up @@ -1389,6 +1392,7 @@ struct AcbMatSpace <: MatSpace{AcbFieldElem}
base_ring::AcbField

function AcbMatSpace(R::AcbField, r::Int, c::Int)
(r < 0 || c < 0) && throw(_err_dim_negative)
return new(r, c, R)
end
end
Expand Down
1 change: 0 additions & 1 deletion src/arb/ComplexMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,5 @@ end

function matrix_space(R::ComplexField, r::Int, c::Int; cached = true)
# TODO/FIXME: `cached` is ignored and only exists for backwards compatibility
(r <= 0 || c <= 0) && error("Dimensions must be positive")
return ComplexMatSpace(R, r, c)
end
1 change: 0 additions & 1 deletion src/arb/RealMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,5 @@ promote_rule(::Type{RealMat}, ::Type{QQMatrix}) = RealMat

function matrix_space(R::RealField, r::Int, c::Int; cached = true)
# TODO/FIXME: `cached` is ignored and only exists for backwards compatibility
(r <= 0 || c <= 0) && error("Dimensions must be positive")
return RealMatSpace(R, r, c)
end
1 change: 0 additions & 1 deletion src/arb/acb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,5 @@ end

function matrix_space(R::AcbField, r::Int, c::Int; cached = true)
# TODO/FIXME: `cached` is ignored and only exists for backwards compatibility
(r <= 0 || c <= 0) && error("Dimensions must be positive")
return AcbMatSpace(R, r, c)
end
1 change: 0 additions & 1 deletion src/arb/arb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,5 @@ promote_rule(::Type{ArbMatrix}, ::Type{QQMatrix}) = ArbMatrix

function matrix_space(R::ArbField, r::Int, c::Int; cached = true)
# TODO/FIXME: `cached` is ignored and only exists for backwards compatibility
(r <= 0 || c <= 0) && error("Dimensions must be positive")
return ArbMatSpace(R, r, c)
end
4 changes: 3 additions & 1 deletion src/flint/FlintTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4829,6 +4829,7 @@ struct QQMatrixSpace <: MatSpace{QQFieldElem}
ncols::Int

function QQMatrixSpace(r::Int, c::Int)
(r < 0 || c < 0) && throw(_err_dim_negative)
return new(r, c)
end
end
Expand Down Expand Up @@ -4992,7 +4993,8 @@ struct ZZMatrixSpace <: MatSpace{ZZRingElem}
ncols::Int

function ZZMatrixSpace(r::Int, c::Int)
return new(r, c)
(r < 0 || c < 0) && throw(_err_dim_negative)
return new(r, c)
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/flint/gfp_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ end

function matrix_space(R::fpField, r::Int, c::Int; cached::Bool = true)
# TODO/FIXME: `cached` is ignored and only exists for backwards compatibility
fpMatrixSpace(R, r, c)
fpMatrixSpace(R, r, c)
end

################################################################################
Expand Down

0 comments on commit a837dca

Please sign in to comment.