Example #1
0
def maslovIndex(g, rect):
    """
    something about Maslov index
    """
    p1, p2 = recToPermAndComp(rect)[0]
    tabMas = generators.maslovTab(p1)
    ipp = generators._I(p1, p1)
    g.maslov = generators._I(g.perm, g.perm)
    return generators.maslovIndex2(g, tabMas, ipp)
Example #2
0
def classifiedGen(rect,ell,strat=0):
    (p1,p2)=rectDiagMisc.recToPermAndComp(rect)[0]
    tabAl=rectDiagMisc.getWindingNbTable(p1,p2)
    print "alexander table:",tabAl
    AShift=alexIndexShift(rect,tabAl,ell)
    print "alexander Index Shift",AShift
##    

    
    tabMas=maslovTab(p1)
    ipp=_I(p1,p1)
##    print "Mazlov predata:"
##    print p1
##    print (tabMas,ipp)

    if strat==0:
        (gen,pool)=genGen(ell[0],ell[1])
        print "nb of gens:"
        print len(gen)
        (gen,bounds)=combinatoric.putInTable2d(gen,lambda x:alexIndexRaw(x,tabAl)+AShift,maslovIndex2(x,tabMas,ipp))
##    (gen,bounds)=combinatoric.putInTable2d(gen,lambda x:(maslovIndex(x,p1),alexIndexRaw(x,tabAl)))
    else:
        import gc
        n=len(rect)
        bd=(n-1)*n/2
        aiml,aimr=0,0
        for i in xrange(len(tabAl)):
            aiml+=min(tabAl[i])
            aimr+=max(tabAl[i])
        minimum=aiml
        right,left=0,0
        line=[0]*(aimr-aiml+1)
        d=-1
        pool="no"
        while(1):
            gc.collect()
            if d==-1:
                aim=aiml
                aimForIndex=aiml+1
            else:aim=aimr
            (gen,pool)=genGen(ell[0],ell[1],0,(aim,tabAl),pool)
            line[aim-minimum]=gen
            print "raw generators:",aim, len(gen)
            if d==-1:
                aiml+=1
                left=len(gen)
            else:
                aimr-=1
                right=len(gen)
            if aimr-aiml==n-2:break
##            print left,right
            if left<=right:d=-1
            else:d=1
        miniA,maxiA=100000,-100000
        miniM,maxiM=100000,-100000
        for i in xrange(len(line)):
            if line[i]==0: continue
            tmp=len(line[i])
            if tmp!=0:
                miniA=min(minimum+i,miniA)
                maxiA=max(minimum+i,maxiA)
                d={}
                for e in line[i]:
                    mas=maslovIndex2(e,tabMas,ipp)
                    if d.has_key(mas):
                        d[mas].append(e)
                    else:
                        d[mas]=[e]
                        
                key=d.keys()
                if key:
                    miniM=min(min(key),miniM)
                    maxiM=max(max(key),maxiM)
                line[i]=d
        bounds=(miniA+AShift,maxiA+AShift,miniM,maxiM)
        gen=[[[] for j in xrange(miniM,maxiM+1)] for i in xrange(miniA,maxiA+1)]
        for i,a in enumerate(line):
            if a:
                for b in a.keys():
                    gen[i+minimum-miniA][b-miniM]=a[b]
        index=aimForIndex-miniA
    return (gen,bounds,pool,index)
Example #3
0
def maslovIndex(g,rect):
    (p1,p2)=rectDiagMisc.recToPermAndComp(rect)[0]
    tabMas=generators.maslovTab(p1)
    ipp=generators._I(p1,p1)
    g.maslov=generators._I(g.perm,g.perm)
    return generators.maslovIndex2(g,tabMas,ipp)
Example #4
0
def classifiedGen(rect, ell, strat=0):
    p1, p2 = rectDiagMisc.recToPermAndComp(rect)[0]
    tabAl = rectDiagMisc.getWindingNbTable(p1, p2)
    print("alexander table:", tabAl)
    AShift = alexIndexShift(rect, tabAl, ell)
    print("alexander Index Shift", AShift)

    tabMas = maslovTab(p1)
    ipp = _I(p1, p1)

    if strat == 0:
        gen, pool = genGen(ell[0], ell[1])
        print("nb of gens:")
        print(len(gen))
        gen, bounds = putInTable2d(
            gen, lambda x:
            (alexIndexRaw(x, tabAl) + AShift, maslovIndex2(x, tabMas, ipp)))

    else:
        import gc
        n = len(rect)
        aiml, aimr = 0, 0
        for i in range(len(tabAl)):
            aiml += min(tabAl[i])
            aimr += max(tabAl[i])
        minimum = aiml
        right, left = 0, 0
        line = [0] * (aimr - aiml + 1)
        d = -1
        pool = "no"
        while True:
            gc.collect()
            if d == -1:
                aim = aiml
                aimForIndex = aiml + 1
            else:
                aim = aimr
            gen, pool = genGen(ell[0], ell[1], 0, (aim, tabAl), pool)
            line[aim - minimum] = gen
            print("raw generators:", aim, len(gen))
            if d == -1:
                aiml += 1
                left = len(gen)
            else:
                aimr -= 1
                right = len(gen)
            if aimr - aiml == n - 2:
                break
            if left <= right:
                d = -1
            else:
                d = 1
        miniA, maxiA = 100000, -100000
        miniM, maxiM = 100000, -100000
        for i in range(len(line)):
            if line[i] == 0:
                continue
            tmp = len(line[i])
            if tmp:
                miniA = min(minimum + i, miniA)
                maxiA = max(minimum + i, maxiA)
                d = {}
                for e in line[i]:
                    mas = maslovIndex2(e, tabMas, ipp)
                    if mas in d:
                        d[mas].append(e)
                    else:
                        d[mas] = [e]

                keys = list(d)
                if keys:
                    miniM = min(min(keys), miniM)
                    maxiM = max(max(keys), maxiM)
                line[i] = d

        bounds = (miniA + AShift, maxiA + AShift, miniM, maxiM)
        gen = [[[] for j in range(miniM, maxiM + 1)]
               for i in range(miniA, maxiA + 1)]
        for i, a in enumerate(line):
            if a:
                for b in a:
                    gen[i + minimum - miniA][b - miniM] = a[b]
        index = aimForIndex - miniA
    return (gen, bounds, pool, index)