Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some MatrixRing fixes #1852

Merged
merged 2 commits into from
Oct 9, 2024
Merged
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
1 change: 1 addition & 0 deletions src/MatRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ end


function characteristic(a::MatRing)
iszero(a.n) && return 1
return characteristic(base_ring(a))
end

Expand Down
1 change: 1 addition & 0 deletions src/generic/MatRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ end
function matrix_ring(R::AbstractAlgebra.NCRing, n::Int; cached::Bool = true)
# TODO: the 'cached' argument is ignored and mainly here for backwards compatibility
# (and perhaps future compatibility, in case we need it again)
@req n >= 0 "n must be a non-negative integer"
T = elem_type(R)
return MatRing{T}(R, n)
end
4 changes: 4 additions & 0 deletions test/generic/MatRing-test.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@testset "Generic.MatAlg.constructors" begin
R, t = polynomial_ring(QQ, "t")
@test_throws ArgumentError matrix_ring(R, -1)

S = matrix_ring(R, 3)

@test S === matrix_ring(R, 3)
Expand Down Expand Up @@ -177,6 +179,8 @@ end
@test is_zero_column(M, 1)

@test degree(M) == 2

@test characteristic(matrix_ring(R, 0)) == 1
end

@testset "Generic.MatAlg.size/axes" begin
Expand Down
Loading