diff --git a/src/generic/Matrix.jl b/src/generic/Matrix.jl index 0a8384c450..f56f5672bf 100644 --- a/src/generic/Matrix.jl +++ b/src/generic/Matrix.jl @@ -138,6 +138,18 @@ end # ############################################################################### +@doc Markdown.doc""" + nrows(a::Generic.MatrixSpace) +> Return the number of rows of the given matrix space. +""" +nrows(a::MatSpace) = a.nrows + +@doc Markdown.doc""" + ncols(a::Generic.MatrixSpace) +> Return the number of columns of the given matrix space. +""" +ncols(a::MatSpace) = a.ncols + function Base.hash(a::AbstractAlgebra.MatElem, h::UInt) b = 0x3e4ea81eb31d94f4%UInt for i in 1:nrows(a) @@ -151,7 +163,7 @@ end @doc Markdown.doc""" nrows(a::Generic.MatrixElem) -> Return the number of nrows of the given matrix. +> Return the number of rows of the given matrix. """ nrows(a::MatrixElem) = size(a.entries, 1) diff --git a/test/generic/Matrix-test.jl b/test/generic/Matrix-test.jl index 77a717609d..c686c1b782 100644 --- a/test/generic/Matrix-test.jl +++ b/test/generic/Matrix-test.jl @@ -85,6 +85,9 @@ function test_gen_mat_constructors() @test elem_type(S) == Generic.Mat{elem_type(R)} @test elem_type(Generic.MatSpace{elem_type(R)}) == Generic.Mat{elem_type(R)} @test parent_type(Generic.Mat{elem_type(R)}) == Generic.MatSpace{elem_type(R)} + @test base_ring(S) == R + @test nrows(S) == 3 + @test ncols(S) == 3 @test typeof(S) <: Generic.MatSpace