Ask Your Question

Revision history [back]

Checking whether a fan is projective: any way to get it faster?

I need to check whether a certain complete fan in R^3 is projective or not. What I tried was export the fan to macaulay2, and apply isPolytopal. However, while completeness is checked in like 30 sec, the polytopality gets stuck, the program doesn't finish in any reasonable time (we left it running for the night, with no result). My question is: are there any more effective ways of checking whether fans are polytopal or not?

Just in case, attached is my code:

macaulay2('loadPackage "Polyhedra"')

L = ToricLattice(4)
Q = ToricLattice(3)
h = L.hom([[1,0,0],[0,1,0],[0,0,1],[-1,-1,-1]],Q)

#rays in sage:

rays = [h((0,2,0,1)),h((0,3,0,2)),h((0,3,1,2)),h((0,5,2,3)),h((0,4,1,2)),h((0,1,0,1)),h((0,1,1,1)),h((0,3,2,2)),h((0,2,1,1)),h((0,0,0,1)),h((0,0,1,1)),h((0,0,1,0)),h((0,3,1,1)),h((1,0,1,1)),h((0,1,0,0)),h((1,0,0,1)),h((1,0,0,0)),h((1,3,0,1)),h((0,4,0,1)),h((1,1,0,1)),h((2,3,0,2)),h((1,2,0,1)),h((0,3,0,1)),h((1,3,0,2)),h((2,5,0,3)),h((1,4,0,2)),h((0,5,0,2))]

#exporting rays to Macaulay

raylist = []
for i in rays:
    a = i[0]
    b = i[1]
    c = i[2]
    raylist.append(macaulay2(f'{a},{b},{c}'))

newraylist = []

for i in raylist:
    newraylist.append(macaulay2(f'toList{i}'))

#cones in sage:

cones=[(1,2,6),(2,3,6),(3,4,8),(1,5,6),(3,6,7),(3,7,8),(5,6,9),(6,7,11),(7,8,11),(6,9,10),(6,10,11),(8,11,12),(8,12,18),(10,11,13),(11,12,14),(11,13,16),(11,14,16),(13,15,16),(14,16,17),(15,16,19),(16,17,21),(17,18,21),(16,19,20),(16,20,21),(18,21,22),(19,20,24),(20,21,24),(21,22,26),(19,23,24),(21,24,25),(21,25,26),(0,2,3,4),(12,14,17,18),(9,10,13,15),(9,15,19),(8,18,22),(5,9,19),(1,5,19),(1,19,23),(0,1,2,23),(0,23,24,25),(22,26,8),(0,4,25,26),(4,8,26)]

#creating the fan in macaulay with cones as above

macaulay2('Z = coneFromVData matrix {{0,0,0},{0,0,0},{0,0,0}}')
macaulay2('F = fan Z')


conelist = []
for cone in cones:
    if len(cone) == 3:
        macaulay2(f'v1 = vector {newraylist[cone[0]]}');
        macaulay2(f'v2 = vector {newraylist[cone[1]]}');
        macaulay2(f'v3 = vector {newraylist[cone[2]]}');   
    macaulay2('C = coneFromVData matrix {v1,v2,v3}');
    macaulay2('F = addCone(C,F)')
if len(cone) == 4:
    macaulay2(f'v1 = vector {newraylist[cone[0]]}');
    macaulay2(f'v2 = vector {newraylist[cone[1]]}');
    macaulay2(f'v3 = vector {newraylist[cone[2]]}');
    macaulay2(f'v4 = vector {newraylist[cone[3]]}'); 
    macaulay2('C = coneFromVData matrix {v1,v2,v3,v4}');
    macaulay2('F = addCone(C,F)')

#checking completeness and polytopality 

macaulay2('isComplete F')
macaulay2('isPolytopal F')