Skip to content

Commit

Permalink
Restore similar/zero method for MatRingElem with row *and* column arg
Browse files Browse the repository at this point in the history
These don't really make much sense and I suggest we deprecate them in
the future but for now I want to keep it simple.
  • Loading branch information
fingolfin committed Nov 12, 2024
1 parent cea07e2 commit 71d6f09
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/MatRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ end

similar(x::MatRingElem, n::Int) = similar(x, base_ring(x), n)

# TODO: deprecate these:
function similar(x::MatRingElem{T}, R::NCRing, m::Int, n::Int) where T <: NCRingElement
m != n && error("Dimensions don't match in similar")
return similar(x, R, n)
end

similar(x::MatRingElem, m::Int, n::Int) = similar(x, base_ring(x), m, n)

@doc raw"""
zero(x::MatRingElem, R::NCRing, n::Int)
zero(x::MatRingElem, R::NCRing)
Expand All @@ -107,6 +115,10 @@ with defaults based upon the given source matrix ring element `x`.
zero(x::MatRingElem, R::NCRing=base_ring(x), n::Int=degree(x)) = zero!(similar(x, R, n))
zero(x::MatRingElem, n::Int) = zero!(similar(x, n))

# TODO: deprecate these
zero(x::MatRingElem, R::NCRing, r::Int, c::Int) = zero!(similar(x, R, r, c))
zero(x::MatRingElem, r::Int, c::Int) = zero!(similar(x, r, c))

################################################################################
#
# Copy and deepcopy
Expand Down

0 comments on commit 71d6f09

Please sign in to comment.