# Revision history [back]

### span of a matrixspace

given a matrix subspace of sparse matrices over a ring Q

M=MatrixSpace(Q,1000,1000, sparse=True)

I need a way to define the subspace N of M given a list of matrices of M

I tried to turn matrices into lists and use the VectorSpace category, however my matrices are sparse matrices, and this takes very long

### span of a matrixspace

given a matrix subspace of sparse matrices over a ring Q

M=MatrixSpace(Q,1000,1000, sparse=True)

I need a way to define the subspace N of M given a list of matrices of M

I tried to turn matrices into lists and use the VectorSpace category, however my matrices are sparse matrices, and this takes very long

def lista(A): #converts a matrix into a list return A.list()

def coor(P): # for the determined base B, it gives the coordinate vector of a matrix P[0] A=base(P[1][1]) k=len(P[1][1]) V=VectorSpace(Q,2*(2k), sparse=True) #I would like to work with MatrixSpace instead B=[] for i in range(len(A)): a=A[i][0] B.append(V(lista(a))) W=W=V.span_of_basis(B) #I dont know if this function exists in MatrixSpace p=W.coordinate_vector(V(lista(P[0])))
return p

### span of a matrixspace

given a matrix subspace of sparse matrices over a ring Q

M=MatrixSpace(Q,1000,1000, sparse=True)

I need a way to define the subspace N of M given a list of matrices of M

I tried to turn matrices into lists and use the VectorSpace category, however my matrices are sparse matrices, and this takes very long

def lista(A):  #converts a matrix into a list
return A.list()A.list()
def coor(P): # for the determined base B, it gives the coordinate vector of a matrix P[0]
A=base(P[1][1])
k=len(P[1][1])
V=VectorSpace(Q,2*(2k), V=VectorSpace(Q,2**(2*k), sparse=True) #I would like to work with MatrixSpace instead
B=[]
B=[] #this will be my basis
for i in range(len(A)):
a=A[i][0]
B.append(V(lista(a)))
W=W=V.span_of_basis(B) #I dont know if this function exists in MatrixSpace
p=W.coordinate_vector(V(lista(P[0])))
return pp