Please refer to my question at https://ask.sagemath.org/question/63878/making-code-faster-by-splitting-and-use-of-supercomputer/
According to the suggestion given in the end by Max Alekseyev I have made a complete code. Here I am showing only the initial part , as problem lies in it . I don't know what I am missing or what mistake I have made.
M = matrix(3,3, [1, 1, 1, -1, 1, 1, -1, -1, 1]) List_S=[M^0,M^1,M^2] n = 3 V = GF(2)^(n^2) VL1=V.list()[1:] VL2=VL1[:-1] P=[] for v in VL2: P.append(matrix(ZZ,n,n,v)) N=[] for p in P: k=-p N.append(k) U = [] for a in P: U.append(a) for b in N: U.append(b) show("U=",len(U)) def mat_to_vector(m): temp = [] for i in range(m.ncols()): for j in range(m.nrows()): temp.append(m[i][j]) return(vector(temp)) CAND=[] for i in range(len(U)): List_U=[U[i]] List_SU=List_S+List_U W=U[:] W.remove(W[i]) T=tuple(List_SU) X = ZZ^(n^2) Y = X.span(mat_to_vector(T[i]) for i in range(len(T))) for w in W: if mat_to_vector(w) in Y: CAND.append(mat_to_vector(w)) VTM=[matrix(ZZ,n,n,u) for u in CAND] for b in VTM: b.set_immutable() B = set(VTM) show("B=",len(B))
According to the suggestion, len(B) should come out to be less than len(U). But it is coming out to be same as len(U). Kindly find the error.