Anyone who has computing power and can run some code for me?

asked 2020-09-24 11:13:02 -0500

SarahDi gravatar image

Hello, I am running the following code (which should be correct because it works and gives results when applied to E7, E6, up to a couple of modification, A6 and A5 for instance), and on my laptop it takes ages, and actually has not even started to compute the first 5000 cases. Can anyone just help me by running it on some more powerful computer? Is there any other website where I could ask for this kind of help? :

a1 = vector((1/2, -1/2, -1/2, -1/2, -1/2, -1/2, -1/2, 1/2))
a2 = vector((1, 1, 0, 0, 0, 0, 0, 0))
a3 = vector((-1, 1, 0, 0, 0, 0, 0, 0))
a4 = vector((0, -1, 1, 0, 0, 0, 0, 0))
a5 = vector((0, 0, -1, 1, 0, 0, 0, 0))
a6 = vector((0, 0, 0, -1, 1, 0, 0, 0))
a7 = vector((0, 0, 0, 0, -1, 1, 0, 0))
a8 = vector((0, 0, 0, 0, 0, -1, 1, 0))

def proj(t, ai):
     myLone = vector(ai)
     result= t - myLone.dot_product(t) / (ai.dot_product(ai))*myLone
     return result


  # produce all combinaisons in myL of five vectors, and apply the procedure to them: the procedure consists in writing
  # the Weyl group associated to any five elements in myL (call any myLel)

def gensi(t, projai):
   myLone = projai
   result = t- 2*myLone.dot_product(t)/(projai.dot_product(projai))*myLone
   return result

 def decompose(g, mylength):
# g is a str(aa) where aa belongs to list(WeylGroup ...)
      listg = [g[3*i]+ g[3*i+1] for i in range(0, mylength)]
      return listg

def letsapply(listg, alist, p1, p2, p3, p4, p5, p6, p7):
      mylistg = listg
      mylistg.reverse()
      for si in mylistg:
    if si == 's1':
        alist = map(lambda w: gensi(w, p1), alist)
    elif si == 's2':
        alist = map(lambda w: gensi(w, p2), alist)
    elif si == 's3':
        alist = map(lambda w: gensi(w, p3), alist)
    elif si == 's4':
        alist = map(lambda w: gensi(w, p4), alist)
    elif si == 's5':
        alist = map(lambda w: gensi(w, p5), alist)
    elif si == 's6':
        alist = map(lambda w: gensi(w, p6), alist)
    elif si == 's7':
        alist = map(lambda w: gensi(w, p7), alist)   
    else:
        print("Wrong input in letsapply!!")
alistt = [tuple(v) for v in alist]
alistts = set(alistt)

return alistts


  import sys
  from timeit import default_timer as timer

 def main():
  starttime = timer()
 W = WeylGroup(["A", 7], prefix="s")
  listW = list(W)
  # We remove the first element which is 1:
  listW.pop(0)
  listWdecomposed = [decompose(str(g), g.length()) for g in listW]

 e = RootSystem(['E',8]).ambient_space()
Roots = e.roots()
## get all projections of roots in E6
myR = [vector(v) for v in Roots]
myL = [proj(x, a2) for x in myR]
myL = [pp for pp in myL if pp != zero_vector(8)]
print("myL = ", myL)
print("myL has ", len(myL), " components.") 

print(len(Combinations(myL, 7).list()))
print("End of precomputations, beginning of the loop.")
WhenToTell = 5000 # Every WhenToTell, the program writes something
CounterToTell = 0
for myLel in Combinations(myL, 7):
    #print("Next element of myLlist ...")
    [proja1, proja2, proja3, proja4, proja5, proja6, proja7] = myLel
    res = set(tuple(v) for v in myLel)
    CounterToTell += 1 # We add 1
    ShouldTakeNextmyLel = False
    ### NONONO print("Trying ", myLel)
    for listg in listWdecomposed:
        res = res.union(letsapply(listg, myLel, proja1, proja2, proja3, proja4, proja5, proja6, proja7))
        #sys.stdout.write(".")# That's print without a return
        if len(res) > 56:
            ShouldTakeNextmyLel = True
            break # No use continuing with this myLel
    if ShouldTakeNextmyLel:
        next
    # On reconvertit :
    res = [vector(v) for v in res]
    res = list(res)
    #print("End")

    if len(res) == 56:    
        LLL =[]
        lst=[]
        for a in myLel:
            for b in myLel:
                R = a.dot_product(b)
                lst.append(R)
            #print(a, lst, "lst") 
            if  (lst.count(-1)==1 or lst.count(-1)==2) and lst.count(1)==0 and lst.count(2) ==1 and (lst.count(0)==4 or lst.count(0)==5):
                LLL.append(lst)
                lst=[]
            else:
                break 

        if len(LLL) ==7: 
            print("myLel = ", myLel)
            print("res = ", res)
            print(LLL, "LLL") 
        #else:
        #print("not the basis of root system")
        #break # Exceptional exit from "for" loop
    #else:
     #   print("too many vectors in this subspace")
    ## Give some info on the running:
    if CounterToTell%WhenToTell == 0:
        endtime = timer()
        print("We used ", endtime - starttime, " seconds for ", WhenToTell, " cases.")
        starttime = endtime
return 0
main()
edit retag flag offensive close merge delete

Comments

1

Try tu use sagecells it's an externalized service and the server is certainly on more powerfull computer than yours.

Cyrille gravatar imageCyrille ( 2020-09-24 11:59:32 -0500 )edit

You should not create the list listWdecomposed, but only iterate over it. You need to optimize your program before looking for more power.

Concerning computing power, you may rather ask people around you for what they can do to help you. usually, universities have a lot of facilities.

FrédéricC gravatar imageFrédéricC ( 2020-09-24 13:09:39 -0500 )edit