Skip to content

Commit

Permalink
Fix zero(MatrixElem) to call suitable similar methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Nov 8, 2024
1 parent bcdee6b commit dbeead8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,17 @@ zero(a::MatSpace) = a()

@doc raw"""
zero(x::MatrixElem{T}, R::NCRing, r::Int, c::Int) where T <: NCRingElement
zero(x::MatrixElem{T}, R::NCRing=base_ring(x)) where T <: NCRingElement
zero(x::MatrixElem{T}, r::Int, c::Int) where T <: NCRingElement
zero(x::MatrixElem{T}, R::NCRing) where T <: NCRingElement
zero(x::MatrixElem{T}) where T <: NCRingElement
Return a zero matrix similar to the given matrix, with optionally different
base ring or dimensions.
"""
zero(x::MatrixElem{T}, R::NCRing=base_ring(x)) where T <: NCRingElement = zero(x, R, nrows(x), ncols(x))
zero(x::MatrixElem{T}) where T <: NCRingElement = zero(x, nrows(x), ncols(x))
zero(x::MatrixElem{T}, R::NCRing) where T <: NCRingElement = zero(x, R, nrows(x), ncols(x))
zero(x::MatrixElem{T}, R::NCRing, r::Int, c::Int) where T <: NCRingElement = zero!(similar(x, R, r, c))
zero(x::MatrixElem{T}, r::Int, c::Int) where T <: NCRingElement = zero(x, base_ring(x), r, c)
zero(x::MatrixElem{T}, r::Int, c::Int) where T <: NCRingElement = zero!(similar(x, r, c))

@doc raw"""
one(a::MatSpace)
Expand Down

0 comments on commit dbeead8

Please sign in to comment.