On Thu, May 14, 2015 at 4:43 PM, Phoenix <anirbit.mukher...@gmail.com> wrote: > The time trouble starts at the point in the code where it doesn't matter > where the permutation matrices comes from. > > What the main part does is basically this. > > Given any set of matrices of dimensional k it produces by the "product" and > "zip" command all possible ways of distributing those matrices over the set > of edges of the graph of size n . > One fixes some arbitrary orientation for each of the edges. It doesn't > matter what. > Now it creates a matrix M of size kn as a n x n array of size k matrices as > follows : for the (a,b) edge is in the oriented edge list it (1) places into > the (a,b) array position the matrix that was assigned to that edge and (2) > it places into the (b,a) position the inverse of that matrix. Now it > calculates the characteristic polynomial of this M and keeps adding it up > over all possible ways of distributing the matrices over the edges. > >
I ran the block below and it ran without error until I killed it (note the additional print statement at the end) To me this suggests there is no problem with your code. There might be a problem managing a large list. If that is the case, you'll need to think more about other ways to do the computation. To the OP: if you had simply supplied the block below initially, as William Stein suggested, you would have saved both your time and ours. q=2; n=4 g = graphs.CompleteBipartiteGraph(n, n) Edge = [] for (a,b,c) in g.edges (): Edge.append ( (a,b) ) #This is how "rep" is created, Fq2 = [] for i in range (q): for j in range (q): Fq2.append (matrix([[i],[j]])) SL2Fq = [] for i1 in range (q): for i2 in range (q): for i3 in range(q): for i4 in range (q): if (i4*i1-i2*i3)% q == 1 : SL2Fq.append ( matrix( [ [i1, i2],[i3,i4] ] ) ) rep = [] for Y in SL2Fq: M = [] for A in Fq2: B = (Y*A)%q row = [] for C in Fq2: if B == C: row.append ([1]) else: row.append ([0]) M.append(flatten(row)) rep.append (matrix(M).transpose()) P = 0 from itertools import product from itertools import izip for X in product(rep,repeat = len (Edge)): k = izip(Edge,X) M = [[matrix(q^2, q^2, 0)]*(2*n) for ell in range(2*n)] for ((a,b),Y) in k: M [a][b] = Y M [b][a] = Y.inverse() Z = block_matrix(M) P = P + Z.charpoly(x) print P > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.