Skip to content
Open
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
11 changes: 5 additions & 6 deletions src/matrix/MatrixTypes.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -43,4 +43,3 @@ end
function _smatrix_clear_fn(I::smatrix)
libSingular.mp_Delete(I.ptr, I.base_ring.ptr)
end

17 changes: 17 additions & 0 deletions test/matrix/smatrix-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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