Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/MatRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ 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 @@ -113,10 +105,6 @@ 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))

iszero(a::MatRingElem{T}) where T <: NCRingElement = iszero(matrix(a))

one(a::MatRingElem{T}) where T <: NCRingElement = one(parent(a))
Expand Down
8 changes: 7 additions & 1 deletion src/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ $p$ of $A$ belonging to $P$, a lower triangular matrix $L$ and an upper
triangular matrix $U$ such that $p(A) = LU$, where $p(A)$ stands for the
matrix whose rows are the given permutation $p$ of the rows of $A$.
"""
function lu(A::MatrixElem{T}, P = SymmetricGroup(nrows(A))) where {T <: FieldElement}
function lu(A::MatElem{T}, P = SymmetricGroup(nrows(A))) where {T <: FieldElement}
m = nrows(A)
n = ncols(A)
P.n != m && error("Permutation does not match matrix")
Expand Down Expand Up @@ -1905,6 +1905,12 @@ function lu(A::MatrixElem{T}, P = SymmetricGroup(nrows(A))) where {T <: FieldEle
return rank, p, L, U
end

function lu(A::MatRingElem{T}, P = SymmetricGroup(nrows(A))) where {T <: FieldElement}
S = parent(A)
r, p, L, U = lu(matrix(A))
return r, p, S(L), S(U)
end

function fflu!(P::Perm, A::MatrixElem{T}) where {T <: RingElement}
if !is_domain_type(T)
error("Not implemented")
Expand Down
14 changes: 2 additions & 12 deletions test/generic/MatRing-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ end
@test isempty(M) == false
@test isassigned(M, 1, 1) == true

@test iszero(zero(M, 3, 3))
@test iszero(zero(M, QQ, 3, 3))
@test iszero(zero(M, 3))
@test iszero(zero(M, QQ, 3))
@test iszero(zero(M, QQ))

M = zero!(M)
Expand Down Expand Up @@ -1571,11 +1571,6 @@ end
@test !test_zero || iszero(n)
@test parent(n) == matrix_ring(R, r)
@test size(n) == (r, r)
nn = sim_zero(m, r, r)
@test !test_zero || iszero(nn)
@test parent(nn) == matrix_ring(R, r)
@test size(nn) == (r, r)
@test_throws ErrorException sim_zero(m, r, r+1)
for S = [QQ, ZZ, GF(2), GF(5)]
n = sim_zero(m, S)
@test !test_zero || iszero(n)
Expand All @@ -1586,11 +1581,6 @@ end
@test !test_zero || iszero(n)
@test parent(n) == matrix_ring(S, r)
@test size(n) == (r, r)
n = sim_zero(m, S, r, r)
@test !test_zero || iszero(n)
@test parent(n) == matrix_ring(S, r)
@test size(n) == (r, r)
@test_throws ErrorException sim_zero(m, S, r, r+2)
end
end
end
Expand Down
Loading