PLEASE read README.txt file! Be careful: here, the convention for Root System, specially numerotation of simple roots are not the same as Bourbaki, see the page: https://webusers.imj-prg.fr/~jean.michel/gap3/htm/chap085.htm. The computations here are more "brutal" than in a last version of the paper: indeed, we do not use here the results of Khare on the description of the faces of the Weyl Polytopes.
gap3= Gap3(command='/home/pierre-louis/Boulot/LogicielCalcul/gap3-jm/bin/gap.sh'); #To use gap3, replace by your path
gap3.load_package('fanofans'); #load fanofans package
from sage.interfaces.gap3 import GAP3Element # GAP3Element allows to push results into gap3 interface
import numpy as np
gap3('"F"',name='Type')
n=4
gap3(n,name='n') #For Gap
OrbitsList=[[] for i in range(2^n-1)];
ConeList=[[] for i in range(2^n-1)];
RaysConeList=[[] for i in range(2^n-1)];
AffSpaceList=[[] for i in range(2^n-1)];
RankList=[0 for i in range(2^n-1)];
MatAffSpaceList=[[] for i in range(2^n-1)];
NormalList=[[0 for i in range(n)] for j in range(2^n-1)] ;
VectDomList=[[] for i in range(2^n-1)];
VectDomListGap=[[] for i in range(2^n-1)];
CaseList=[[[],[],[],[],[]] for i in range(2^n-1)]
Type=np.dtype([('Dominant Weights',object),('Normal vector',object),('Fano',bool),('Smooth',bool),('Gorenstein',bool)])
CaseList=np.empty(shape=(2^n-1,1),dtype=Type)
List=list(VectorSpace(GF(2),n));
for l in range(2^n-1):
VectDomList[l]=list(vector(QQ,List[l+1]))
CaseList[l,0][0]=vector(QQ,List[l+1])
for l in range(2^n-1):
gap3(VectDomList[l],name='v')
GAP3Element(gap3, value=list(VectDomList[l]), is_name=False, name='ll')
OrbitsList[l]=gap3('OrbitsFanoGen(ll,CoxeterGroup(Type,n))').sage()
for i in range(0,2^n-1):
# cone calculation
orbit=OrbitsList[i]
cone=Cone(orbit)
ConeList[i]=cone
# rays calculation
rays=cone.rays()
print(VectDomList[i])
print("rays")
print(rays)
RaysConeList[i]=rays
# affine space calculation
s=len(rays)
AffSpace=[[] for j in range(s-1)]
for j in range(1,s):
direction=list(rays[j]-rays[0])
AffSpace[j-1]=direction
AffSpace[j-1]
AffSpaceList[i]=AffSpace
MatrixAffSpace=matrix(QQ,AffSpace)
rank=MatrixAffSpace.rank()
RankList[i]=rank
MatAffSpaceList[i]=MatrixAffSpace
ScalarProdMatrix=matrix(QQ,(gap3('ScalarMatrix(CoxeterGroup(Type,n))')).sage());
ScalarProdMatrix
for i in range (0,2^n-1):
if RankList[i]==n-1:
A=MatAffSpaceList[i]*ScalarProdMatrix
basis=A.right_kernel().basis()
vectbasis=(basis[0])
NormalList[i]=vectbasis
CaseList[i,0][1]=vectbasis
print('done')
NormalListNP=np.array(NormalList)
VectDomListNP=np.array(VectDomList)
for i in range(0,2^n-1):
if RankList[i]==n-1 and np.all(NormalListNP[i]>=0) and np.all((VectDomListNP[i]==0)+(NormalListNP[i]!=0))==True:
CaseList[i,0][2]=True
else: CaseList[i,0][2]=False
for i in range(0,2^n-1):
if ConeList[i].is_smooth():
CaseList[i,0][3]=True
else: CaseList[i,0][3]=False
TestVector=[[]for i in range(2^n-1)]
TestScalar=[[] for i in range(2^n-1)]
for i in range(2^n-1):
if CaseList[i,0][2]==True:
TestScalar[i]=vector(QQ,NormalList[i])*ScalarProdMatrix*vector(RaysConeList[i][0])
TestVector[i]=matrix(QQ,NormalList[i])
if all(x in ZZ for x in ((1/TestScalar[i])*TestVector[i]*ScalarProdMatrix).list()):
CaseList[i,0][4]=True
else: CaseList[i,0][4]=False
print(CaseList[CaseList['Fano']==True])