Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use many cups to compute in sage

There is an server with 48 cpus in my office. I want to use all of them to compute the following codes in sage. How can I do that?

%time

import itertools

def is_matrix_integral(M):

for i,j in itertools.product(range(2),range(2)):
    if M[i][j] not in ZZ:
        return False
return True

def Gamma(M):

if is_matrix_integral(M) and M[1][0]%243==0 and M.det()==1:
    return True
return False

p=4

T=Matrix([[2,-1],[9,-4]])*Matrix([[4,0],[0,9]])

W=Matrix([[0,1],[-243,0]])

S=Matrix([[1,1/3],[0,1]])

A=Matrix([[1,0],[81,1]])

B=-1/(243)WA^(-1)WA

C=Matrix([[1,1/9],[-27,-2]])

e=Matrix([[1,0],[0,-1]])

def Q(a,c):

return T*Matrix([[a,a+c],[c,-a]])*T^(-1)*e

I=[-100000..-1]+[1..100000]

for i,j in itertools.product([1..100000],I):

if sqrt(i*i+i*j+j*j) in QQ:
    for k in [0,1,2]:
        L=Q(i,j)*W*Q(i,j)^(-1)*W^(-1)*B^k
        if Gamma(L):
            print x,Q(i,j),Q(i,j).det(),i,j
            for l in [0,1,2]:
                M=Q(i,j)*B*Q(i,j)^(-1)*B^l
                if Gamma(M):
                    print x,x,M,M.det(),i,j,k,l
                    break
click to hide/show revision 2
None

How to use many cups to compute in sage

There is an server with 48 cpus in my office. I want to use all of them to compute the following codes in sage. How can I do that?

%time

import itertools

def is_matrix_integral(M):

for i,j in itertools.product(range(2),range(2)):
    if M[i][j] not in ZZ:
        return False
return True

def Gamma(M):

if is_matrix_integral(M) and M[1][0]%243==0 and M.det()==1:
    return True
return False

p=4

T=Matrix([[2,-1],[9,-4]])*Matrix([[4,0],[0,9]])

W=Matrix([[0,1],[-243,0]])

S=Matrix([[1,1/3],[0,1]])

A=Matrix([[1,0],[81,1]])

B=-1/(243)WA^(-1)WA

C=Matrix([[1,1/9],[-27,-2]])

e=Matrix([[1,0],[0,-1]])

def Q(a,c):

return T*Matrix([[a,a+c],[c,-a]])*T^(-1)*e

I=[-100000..-1]+[1..100000]

for i,j in itertools.product([1..100000],I):

if sqrt(i*i+i*j+j*j) in QQ:
    for k in [0,1,2]:
        L=Q(i,j)*W*Q(i,j)^(-1)*W^(-1)*B^k
        if Gamma(L):
            print x,Q(i,j),Q(i,j).det(),i,j
            for l in [0,1,2]:
                M=Q(i,j)*B*Q(i,j)^(-1)*B^l
                if Gamma(M):
                    print x,x,M,M.det(),i,j,k,l
                    break
click to hide/show revision 3
None

How to use many cups cpus to compute in sage

There is an server with 48 cpus in my office. I want to use all of them to compute the following codes in sage. How can I do that?

%time

import itertools

def is_matrix_integral(M):

%time

import itertools

def is_matrix_integral(M):

    for i,j in itertools.product(range(2),range(2)):
     if M[i][j] not in ZZ:
         return False
 return True

def Gamma(M):

Gamma(M):

    if is_matrix_integral(M) and M[1][0]%243==0 and M.det()==1:
     return True
 return False

p=4

T=Matrix([[2,-1],[9,-4]])*Matrix([[4,0],[0,9]])

W=Matrix([[0,1],[-243,0]])

S=Matrix([[1,1/3],[0,1]])

A=Matrix([[1,0],[81,1]])

B=-1/(243)WA^(-1)WA

C=Matrix([[1,1/9],[-27,-2]])

e=Matrix([[1,0],[0,-1]])

p=4 T=Matrix([[2,-1],[9,-4]])*Matrix([[4,0],[0,9]]) W=Matrix([[0,1],[-243,0]]) S=Matrix([[1,1/3],[0,1]]) A=Matrix([[1,0],[81,1]]) B=-1/(243)*W*A^(-1)*W*A C=Matrix([[1,1/9],[-27,-2]]) e=Matrix([[1,0],[0,-1]]) def Q(a,c):

return T*Matrix([[a,a+c],[c,-a]])*T^(-1)*e

I=[-100000..-1]+[1..100000]

Q(a,c): return T*Matrix([[a,a+c],[c,-a]])*T^(-1)*e I=[-100000..-1]+[1..100000] for i,j in itertools.product([1..100000],I):

itertools.product([1..100000],I):

    if sqrt(i*i+i*j+j*j) in QQ:
     for k in [0,1,2]:
         L=Q(i,j)*W*Q(i,j)^(-1)*W^(-1)*B^k
         if Gamma(L):
             print x,Q(i,j),Q(i,j).det(),i,j
             for l in [0,1,2]:
                 M=Q(i,j)*B*Q(i,j)^(-1)*B^l
                 if Gamma(M):
                     print x,x,M,M.det(),i,j,k,l
                     break