Ask Your Question

grburrul's profile - activity

2018-05-11 12:54:10 -0500 commented question span of a matrixspace

@tmonteil done!

2018-05-11 12:52:36 -0500 received badge  Editor (source)
2018-05-11 07:12:54 -0500 received badge  Student (source)
2018-05-11 03:28:32 -0500 asked a question 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**(2*k), sparse=True) #I would like to work with MatrixSpace instead
   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 p