diff --git a/src/matrix/MatrixTypes.jl b/src/matrix/MatrixTypes.jl index 1676de079..47eada505 100644 --- a/src/matrix/MatrixTypes.jl +++ b/src/matrix/MatrixTypes.jl @@ -1,12 +1,10 @@ ############################################################################### # -# MatrixSpace/smatrix +# MatrixSpace/smatrix # ############################################################################### -const MatrixSpaceID = Dict{Tuple{PolyRing, Int, Int}, Set}() - -mutable struct MatrixSpace{T <: Nemo.RingElem} <: Set +mutable struct MatrixSpace{T <: Nemo.RingElem} <: AbstractAlgebra.MatSpace{T} base_ring::PolyRing nrows::Int ncols::Int @@ -20,7 +18,9 @@ mutable struct MatrixSpace{T <: Nemo.RingElem} <: Set end end -mutable struct smatrix{T <: Nemo.RingElem} <: Nemo.SetElem +const MatrixSpaceID = Dict{Tuple{PolyRing, Int, Int}, MatrixSpace}() + +mutable struct smatrix{T <: Nemo.RingElem} <: AbstractAlgebra.MatElem{T} ptr::libSingular.matrix_ptr base_ring::PolyRing @@ -43,4 +43,3 @@ end function _smatrix_clear_fn(I::smatrix) libSingular.mp_Delete(I.ptr, I.base_ring.ptr) end - diff --git a/test/matrix/smatrix-test.jl b/test/matrix/smatrix-test.jl index 44343a210..ccd080d72 100644 --- a/test/matrix/smatrix-test.jl +++ b/test/matrix/smatrix-test.jl @@ -102,3 +102,20 @@ end @test M1 == M1 @test M1 == deepcopy(M1) end + +@testset "smatrix.rand..." begin + F = Fp(7) + R, _ = PolynomialRing(F, ["x"]) + m = identity_matrix(R, 3) + M = parent(m) + + f = rand(M, 1:2, 1:2) + @test parent(f) == M + + R, _ = PolynomialRing(ZZ, ["x"]) + m = identity_matrix(R, 3) + M = parent(m) + + f = rand(M, 1:2, 1:2, 1:2) + @test parent(f) == M +end