Re: Is it possible for a code to not give answers for large values?

19 views
Skip to first unread message
Message has been deleted

Phoenix

unread,
May 13, 2015, 8:26:36 PM5/13/15
to sage-s...@googlegroups.com
Should add that the matrices are of dimension 2n 

William Stein

unread,
May 13, 2015, 8:29:47 PM5/13/15
to sage-support
On Wed, May 13, 2015 at 5:20 PM, Phoenix <anirbit....@gmail.com> wrote:
>
>
> So I have this SAGE code

Post it. Please make every question you ask here as concrete and
explicit as possible. At a bare minimum post enough so that the
reader can reproduce exactly your problem with minimal effort.
Thanks,

William

> which takes in two integers p and n and it
> generates ~ (p^3)^(n^2) 0/1 matrices and does a sum of their characteristic
> polynomials.
>
> I got answers for (p = 3, n = 2), (p =2 , n = 3) and (p=2, n=2)
>
> For any higher number the code runs for ~1hr and then it says,
>
> "
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "_sage_input_2.py", line 10, in <module>
> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
> -*-\\n" +
> _support_.preparse_worksheet_cell(base64.b64decode("UA=="),globals())+"\\n");
> execfile(os.path.abspath("___code___.py"))
> File "", line 1, in <module>
>
> File "/tmp/tmpPiPIoq/___code___.py", line 2, in <module>
> exec compile(u'P
> File "", line 1, in <module>
>
> "
>
>
> Can someone help understand what is going on?
>
> Like any suggestion about how to go about it?
>
>
> --
> 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...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.



--
William (http://wstein.org)

Phoenix

unread,
May 13, 2015, 8:42:54 PM5/13/15
to sage-s...@googlegroups.com



Okay - this is basically the main time-consuming step.

At this point "rep" comes in as a list of 2 dimensional determinant 1 matrices whose entries are integers from the set {0,1,2,...,(q-1)}
And "Edge" is a list of integer tuples where each tuple is of the form (a,b) with  0<= a,b <= (2n-1)

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 _ 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)

Phoenix

unread,
May 13, 2015, 8:51:39 PM5/13/15
to sage-s...@googlegroups.com

Sorry there was a typo :

"rep" comes in as a ~q^3 size list of q^2 dimensional 0/1 matrices.

So the matrix M that is produced is of size (2n)(q^2) 

Phoenix

unread,
May 13, 2015, 9:14:32 PM5/13/15
to sage-s...@googlegroups.com

I am posting a different post with the question formatted better. 
Reply all
Reply to author
Forward
0 new messages