diff --git a/doc/Test.xml b/doc/Test.xml index 279a3b9a..77c38bb4 100644 --- a/doc/Test.xml +++ b/doc/Test.xml @@ -1075,7 +1075,6 @@ IsHapNonFreeResolution
NEATO_PATH
NerveOfCover
-POLYMAKE_PATH
PseudoList
PseudoListFamily
QUASICATONEGROUP_DATA_NOT
diff --git a/doc/Undocumented.xml b/doc/Undocumented.xml index 7e99b738..6c9b523a 100644 --- a/doc/Undocumented.xml +++ b/doc/Undocumented.xml @@ -7724,8 +7724,6 @@
NerveOfCover    Examples:

-POLYMAKE_PATH    Examples:
-
PseudoList    Examples:

PseudoListFamily    Examples:
diff --git a/lib/Polymake/orbitPoly.gi b/lib/Polymake/orbitPoly.gi index f15bbf7d..e68a9abc 100644 --- a/lib/Polymake/orbitPoly.gi +++ b/lib/Polymake/orbitPoly.gi @@ -2,109 +2,65 @@ ##################################################################### InstallGlobalFunction(OrbitPolytope, function(G,v,Props) -local - Points,p,x,i,w,Dim,tmp,input, tmpdir, tmpIn, tmp2dir, tmp2In, - a,b,c,d,U,V,W,AppendTo, PrintTo; - -AppendTo:=HAP_AppendTo; -PrintTo:=HAP_PrintTo; - -Dim:=Length(v); -Points:=[]; - -tmpdir := DirectoryTemporary();; -tmpIn:=Filename( tmpdir , "tmpIn.log" ); -tmp2dir := DirectoryTemporary();; -tmp2In:=Filename( tmpdir , "tmp2In.log" ); - +local Points,poly, tmp, x, a, b, c, d, U, V, W, X; ############################CREATE POINTS############### if IsPermGroup(G) then - -for x in G do -w:=[]; - for i in [1..Dim] do - Append(w,[v[i^x]]); - od; -Append(Points, [w]); -od; - + Points := Orbit(G, v, Permuted); else - -for x in G do - w:=v*x; - Append(Points, [w]); - od; + Points := Orbit(G, v, OnRight); fi; ######################POINTS CREATED################### ################## CALCULATE HULL POINTS ############### -AppendTo(tmpIn,"POINTS","\n"); -for p in Points do -AppendTo(tmpIn,1); - for i in [1..Dim] do - AppendTo(tmpIn," ",p[i]); - od; -AppendTo(tmpIn,"\n"); -od; + +poly:=CreatePolymakeObject(); +AppendPointlistToPolymakeObject(poly,Points); ################# HULL CALCULATED ################################### if "DIMENSION" in Props or "dimension" in Props then -Exec(Concatenation(POLYMAKE_PATH, tmpIn," DIM > ", tmp2In)); -input:=InputTextFile(tmp2In); -tmp:=ReadLine(input); -tmp:=ReadLine(input); -Print("Dimension of orbit polytope is: ", tmp, "\n"); -Exec(Concatenation("rm ", tmp2In)); + tmp := Polymake(poly,"DIM"); + Print("Dimension of orbit polytope is: ", tmp, "\n"); fi; if "VERTEX_DEGREES" in Props or "vertex_degrees" in Props then -Exec(Concatenation(POLYMAKE_PATH,tmpIn, " VERTEX_DEGREES > ",tmp2In)); -input:=InputTextFile(tmp2In); -tmp:=ReadLine(input); -tmp:=ReadLine(input); -Print("Vertex degree in graph of polytope is: ", Rat(Concatenation([tmp{[1..Position(tmp,' ')-1]}])), "\n"); -#Exec(Concatenation("rm ",tmp2In)); + tmp:=Set(Polymake(poly,"VERTEX_DEGREES")); + Print("Vertex degree in graph of polytope is: ", tmp[1], "\n"); fi; - if "VISUAL_GRAPH" in Props or "visual_graph" in Props then -Exec(Concatenation(POLYMAKE_PATH,tmpIn ," VISUAL_GRAPH")); + Polymake(poly,"VISUAL_GRAPH"); fi; if "SCHLEGEL" in Props or "schlegel" in Props then -Exec(Concatenation(POLYMAKE_PATH,tmpIn ," SCHLEGEL")); + Polymake(poly,"SCHLEGEL"); fi; if "VISUAL" in Props or "visual" in Props then - -if IsPermGroup(G) and Length(v)=4 then - Exec(Concatenation("rm ",tmpIn)); - AppendTo(tmpIn,"POINTS","\n"); - - for x in G do - a:=v[1^x]-v[1]; - b:=v[2^x]-v[2]; - c:=v[3^x]-v[3]; - d:=v[4^x]-v[4]; - U:=2*a-2*b; - V:=2*c-2*d; - W:=a+b-c-d; - AppendTo (tmpIn,1," ",U, " ",V," ",W, "\n"); - od; -fi; -Exec(Concatenation(POLYMAKE_PATH,tmpIn ," VISUAL")); + if IsPermGroup(G) and Length(v)=4 then + tmp := ShallowCopy(Points); + for x in G do + a:=v[1^x]-v[1]; + b:=v[2^x]-v[2]; + c:=v[3^x]-v[3]; + d:=v[4^x]-v[4]; + U:=2*a-2*b; + V:=2*c-2*d; + W:=a+b-c-d; + Add(tmp, [1,U,V,W]); + od; + poly:=CreatePolymakeObject(); + AppendPointlistToPolymakeObject(poly,tmp); + fi; + Polymake(poly,"VISUAL"); fi; -#Exec(Concatenation("rm ",tmpIn)); - - end); ##################################################################### @@ -116,41 +72,15 @@ InstallOtherMethod(Display, "method for displaying convex hulls of sets of points", [IsPolymakeObject], function(F) -local - Points,p,x,i,w,Dim,tmp,input, tmpdir, tmpIn, tmp2dir, tmp2In, - a,b,c,d,U,V,W,AppendTo, PrintTo; - -AppendTo:=HAP_AppendTo; -PrintTo:=HAP_PrintTo; - -Dim:=Length(Polymake(F,"F_VECTOR")); -Points:=Polymake(F,"VERTICES"); - -tmpdir := DirectoryTemporary();; -tmpIn:=Filename( tmpdir , "tmpIn.log" ); -tmp2dir := DirectoryTemporary();; -tmp2In:=Filename( tmpdir , "tmp2In.log" ); - - - - -################## CALCULATE HULL POINTS ############### -AppendTo(tmpIn,"POINTS","\n"); -for p in Points do -AppendTo(tmpIn,1); - for i in [1..Dim] do - AppendTo(tmpIn," ",p[i]); - od; -AppendTo(tmpIn,"\n"); -od; - - -################# HULL CALCULATED ################################### - - -Exec(Concatenation(POLYMAKE_PATH,tmpIn ," VISUAL")); - -#Exec(Concatenation("rm ",tmpIn)); + local Dim, Points,poly; + + Dim:=Length(Polymake(F,"F_VECTOR")); + Points:=Polymake(F,"VERTICES"); + + poly:=CreatePolymakeObject(); + AppendPointlistToPolymakeObject(poly,Points); + + Polymake(poly,"VISUAL"); end); ##################################################################### diff --git a/lib/Polymake/polyGens.gi b/lib/Polymake/polyGens.gi index 20f0a99e..528e27a8 100644 --- a/lib/Polymake/polyGens.gi +++ b/lib/Polymake/polyGens.gi @@ -4,250 +4,114 @@ ##################################################################### InstallGlobalFunction(PolytopalGenerators, function(GG,v) -local - Points, Vertices, - Action, - G, D, CG, N, - proj, - StringToVector, - input, - EdgeGenerators, - Faces, FacesFinal, FacesFn, - Index, IndexFn, tmplst, - Count, - tmp, x, w, i, y, p, - AppendTo, PrintTo, - tmpInlog, tmp2Inlog,tmp3Inlog, tmp4Inlog, tmpDir; +local action, G, Points, + vertices, CG, x, w, N, + proj, poly, EdgeGenerators, tmp, + index, i, Faces, FacesFinal, p; -AppendTo:=HAP_AppendTo; -PrintTo:=HAP_PrintTo; - -tmpDir:=DirectoryTemporary(); -tmpInlog:=Filename(tmpDir,"tmpIn.log"); -tmp2Inlog:=Filename(tmpDir,"tmp2In.log"); -tmp3Inlog:=Filename(tmpDir,"tmp3In.log"); -tmp4Inlog:=Filename(tmpDir,"tmp4In.log"); if not (IsPermGroup(GG) or IsMatrixGroup(GG)) then -Print("The group G must be a permutation or matrix group.\n"); -return fail; + Print("The group G must be a permutation or matrix group.\n"); + return fail; fi; if IsPermGroup(GG) then -#GG:=Image(PermToMatrixGroup(GG)); -#fi; -##################################################################### -Action:=function(g,V); -return Permuted(V,g^-1); -end; -##################################################################### + action:=function(g,V) + return Permuted(V,g^-1); + end; else -##################################################################### -Action:=function(g,V) ; -return g*V;; #This actually works! -end; -##################################################################### + action:=function(g,V) + return g*V; #This actually works! + end; fi; -G:=[]; -tmplst:=[]; - +Points:=[]; for x in GG do -w:=Action(x,v); -if not w in tmplst and not w=v then -Add(G,x); -Add(tmplst,w); -fi; -od; - - -D:=Length(v); -CG:=List([1..D], i->0); #CG will eventually be the centre of gravity -Points:=[]; #of the polytope. -Vertices:=[]; -EdgeGenerators:=[]; - -###################### CALCULATE CENTRE OF GRAVITY ################## -for x in G do -Add(Points, Action(x,v)); + w:=action(x,v); # warning: left action! + if not w in Points and not w=v then + Add(Points,w); + fi; od; - -Points:=SSortedList(Points); +Points:=Set(Points); G:=[]; for w in Points do -for x in GG do -if Action(x,v)=w then Add(G,x); break; fi; -##if Action(x,v) in Points then Add(G,x); fi; - -od; + for x in GG do + if action(x,v)=w then + Add(G,x); + break; + fi; + od; od; -for w in Points do - CG:=CG+w; -od; -CG:=CG/Size(Points); +###################### CALCULATE CENTRE OF GRAVITY ################## + +CG:=Sum(Points)/Size(Points); + ##################### CENTRE OF GRAVITY DONE ######################## ################# PROJECTION ################################ N:=CG-v; #This might be parallel to an edge!!! proj:=function(w) - local k, m ; - m:=(w-v)*N; - k:= ((CG-v)*N)/m; - return v+(k*(w-v)); + local k, m; + m:=(w-v)*N; + k:= ((CG-v)*N)/m; + return v+(k*(w-v)); end; ############################################################# ################## CALCULATE HULL OF PROJECTED POINTS ############### -for i in [1..Length(Points)] do -Points[i]:=proj(Points[i]); -od; +Points := List(Points, proj); -AppendTo(tmpInlog,"POINTS","\n"); -for p in Points do -AppendTo(tmpInlog,1); - for i in [1..Length(p)] do - AppendTo(tmpInlog," ",p[i]); - od; -AppendTo(tmpInlog,"\n"); -od; +poly:=CreatePolymakeObject(); +AppendPointlistToPolymakeObject(poly,Points); -#Exec(Concatenation(POLYMAKE_PATH,tmpInlog," beneath_beyond VERTICES > ",tmp3Inlog)); #Added "beneath_beyond" -Exec(Concatenation(POLYMAKE_PATH,tmpInlog," VERTICES > ",tmp3Inlog)); ################# HULL CALCULATED ################################### -##################################################################### -StringToVector:=function(s) -local V,x,y; - -V:=[]; y:=[]; - -for x in s do -if not x=' ' then Append(y,[x]); -else -Append(V,[Rat(Chomp(y))]); y:=[]; -fi; -od; -Append(V,[Rat(Chomp(y))]); - -return V{[2..Length(V)]}; -end; -##################################################################### - ################# READ VERTICES ##################################### -input:=InputTextFile(tmp3Inlog); - -tmp:=ReadLine(input); -tmp:=ReadLine(input); -i:=1; -while tmp[1]='1' do -Vertices[i]:=tmp; -tmp:=ReadLine(input); -i:=i+1; -od; - -Apply(Vertices, s->StringToVector(s)); -RemoveFile(tmp3Inlog); - +vertices := Polymake(poly,"VERTICES"); ################ VERTICES READ ###################################### ################ RECOVER THE EDGE GENERATORS ######################## +EdgeGenerators:=[]; for w in Points do -p:=w; -if p in Vertices then -x:=G[Position(Points,w)]; -EdgeGenerators[Position(Vertices,p)]:=x; -fi; + if w in vertices then + x:=G[Position(Points,w)]; + EdgeGenerators[Position(vertices,w)]:=x; + fi; od; ################ EDGE GENERATORS RECOVERED ########################## ################ READ HASSE DIAGRAM ################################# -Exec(Concatenation(POLYMAKE_PATH,tmpInlog," \"HASSE_DIAGRAM -> FACES\" >",tmp2Inlog)); -#Exec(Concatenation(POLYMAKE_PATH,tmpInlog," \"HASSE_DIAGRAM -> DIMS\" >",tmp4Inlog)); -Exec(Concatenation(POLYMAKE_PATH,tmpInlog," \"F_VECTOR\" >",tmp4Inlog)); -RemoveFile(tmpInlog); -Filename(tmpDir,tmp); -RemoveFile(tmp); - -Faces:=[]; -Index:=[]; - ############################################################# - IndexFn:=function(tmp) - local V,x,y; - V:=[]; - y:=[]; - - for x in tmp do - if (not x=' ') and (not x='\n') then Append(y,[x]); - else - Append(V,[Rat(Chomp(y))]); y:=[]; fi; - od; - - return V; - end; - ############################################################ - - ############################################################ - FacesFn:=function(tmp) - local V,x,y; - V:=[]; y:=[]; - - for x in tmp do - if (not x='<') and (not x='(') and (not x='{') then - if (not x=' ') and (not x='}') then Append(y,[x]); - else - if Length(y)>0 then - Append(V,[Rat(Chomp(y))]); y:=[]; fi; fi; - fi; - if x='}' then break; fi; - od; - - if Length(V)>0 then - return [V]; - else - return []; fi; - end; - ############################################################ - -input:=InputTextFile(tmp4Inlog); -tmp:=ReadLine(input); -tmp:=ReadLine(input); -#Index:=IndexFn(tmp); -tmp:= IndexFn(tmp); #Modified July 2019 -Index:=[1]; #because Polymake has +tmp := Polymake(poly,"F_VECTOR"); +index:=[1]; #because Polymake has for i in [1..Length(tmp)] do #discontinued the DIMS -Add(Index,Index[i]+tmp[i]); #property. +Add(index,index[i]+tmp[i]); #property. od; # -RemoveFile(tmp4Inlog); -input:=InputTextFile(tmp2Inlog); -tmp:=ReadLine(input); -tmp:=ReadLine(input); - -while Length(tmp)>2 do -Append(Faces, FacesFn(tmp)); -tmp:=ReadLine(input); -od; -#RemoveFile(tmp2Inlog); +Faces := Polymake(poly,"FACES"); +if Length(Faces[1])=0 then + Remove(Faces,1); +fi; +Faces:=List(Faces, f -> f-1); if Length(Faces[1])=1 then FacesFinal:=[]; - for i in [1..Length(Index)-1] do - Append(FacesFinal,[[Index[i]..Index[i+1]-1]]); + for i in [1..Length(index)-1] do + Append(FacesFinal,[[index[i]..index[i+1]-1]]); od; - Append(FacesFinal,[[Index[i+1]]]); + Append(FacesFinal,[[index[i+1]]]); FacesFinal:=(List(FacesFinal,x->List(x,i->Faces[i]))); else - FacesFinal:=[[1..Index[1]]]; - for i in [1..Length(Index)-1] do - Append(FacesFinal,[[Index[i]+1..Index[i+1]]]); + FacesFinal:=[[1..index[1]]]; + for i in [1..Length(index)-1] do + Append(FacesFinal,[[index[i]+1..index[i+1]]]); od; FacesFinal:=Reversed(List(FacesFinal,x->List(x,i->Faces[i]))); @@ -266,11 +130,6 @@ for i in [2..Length(FacesFinal)-1] do od; fi; -RemoveFile(tmpInlog); -#RemoveFile(tmp2Inlog); -RemoveFile(tmp4Inlog); -RemoveFile(tmp3Inlog); -RemoveFile(Filename(tmpDir," ")); ############### HASSE DIAGRAM READ ################################## return rec( generators:=EdgeGenerators, diff --git a/lib/Polymake/polymakeLegacy b/lib/Polymake/polymakeLegacy deleted file mode 100755 index 3d5b671f..00000000 --- a/lib/Polymake/polymakeLegacy +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - - -file=$1; - -if [ $# == 2 ] -then - opt1=$2; - polymake "my \$c=load(\"$file\"); print \"$opt1\n\", \$c->$opt1, \"\n\n\";" ; -fi - -if [ $# == 3 ] -then - opt1=$2; - opt2=$3; - polymake "my \$c=load(\"$file\"); print \"$opt1\n\", \$c->$opt1, \"\n\n\", \"$opt2\n\", \$c->$opt2, \"\n\n\";" ; -fi - -if [ $# == 4 ] -then - opt1=$2; - opt2=$3; - opt3=$4; - polymake "my \$c=load(\"$file\"); print \"$opt1\n\", \$c->$opt1, \"\n\n\", \"$opt2\n\", \$c->$opt2, \"\n\n\", \"$opt3\n\", \$c->$opt3, \"\n\n\" ;" -fi - diff --git a/lib/externalSoftware.gap b/lib/externalSoftware.gap index 7cb4aefe..771194a7 100644 --- a/lib/externalSoftware.gap +++ b/lib/externalSoftware.gap @@ -1,24 +1,4 @@ ############################################################# -if not IsBound(POLYMAKE_PATH) - then -ReadPackage("HAP","boolean"); -HAP_ROOT:=DirectoriesPackageLibrary("HAP"); -HAP_ROOT:=Filename(HAP_ROOT,"."); -HAP_ROOT:=HAP_ROOT{[1..Length(HAP_ROOT)-1]}; - -# POLYMAKE_PATH:=Filename( DirectoriesSystemPrograms( ), "polymake" ); -POLYMAKE_PATH:=Concatenation(HAP_ROOT,"Polymake/polymakeLegacy"); - -if POLYMAKE_PATH=fail - or not IsExecutableFile(POLYMAKE_PATH) - then - Info(InfoWarning,1,"HAP warning: Set POLYMAKE_PATH manually if needed. "); -else -POLYMAKE_PATH:=Concatenation(POLYMAKE_PATH," "); - MakeReadOnlyGlobal("POLYMAKE_PATH"); -fi; -fi; -############################################################# ############################################################# if not IsBound(NEATO_PATH) diff --git a/read.g b/read.g index 4fcb26db..fd9956e8 100644 --- a/read.g +++ b/read.g @@ -11,12 +11,6 @@ HAP_ROOT:=DirectoriesPackageLibrary("HAP"); HAP_ROOT:=Filename(HAP_ROOT,"."); HAP_ROOT:=HAP_ROOT{[1..Length(HAP_ROOT)-1]}; MakeReadOnlyGlobal("HAP_ROOT"); -#POLYMAKE_PATH:=Concatenation(HAP_ROOT,"Polymake/polymakeLegacy "); -#POLYMAKE_PATH:=Filename( DirectoriesSystemPrograms( ), "polymake" ); -#MakeReadOnlyGlobal("POLYMAKE_PATH"); -#MakeReadWriteGlobal("POLYMAKE_COMMAND"); -#POLYMAKE_COMMAND:=POLYMAKE_PATH; -#MakeReadOnlyGlobal(POLYMAKE_COMMAND); #################################