Skip to content

Commit

Permalink
Add in another interface file I have, this one to PALP, this interfac…
Browse files Browse the repository at this point in the history
…e is still very rough
  • Loading branch information
mikestillman committed Jun 1, 2024
1 parent 2eca8c1 commit bf6961a
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 0 deletions.
158 changes: 158 additions & 0 deletions CYToolsM2/PALPInterface.m2
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
newPackage(
"PALPInterface",
Version => "0.1",
Date => "",
Headline => "An interface to parts of the PALP polyhedra software",
Authors => {{ Name => "", Email => "", HomePage => ""}},
AuxiliaryFiles => false,
DebuggingMode => true,
PackageImports => {"ReflexivePolytopesDB"}
)

export {
"palpVertices"
}

executableDir = "/Users/mike/src/git-from-others/PALPfromTGZ/palp-2.21/";

programPaths#"PALP" = executableDir;
PALP = findProgram("PALP", "poly.x -h")

programPaths#"poly.x" = executableDir;
polyx = findProgram("poly.x", "poly.x -h")

-* Code section *-
palpMatrix = method()
palpMatrix Matrix := String => M -> (
if ring M =!= ZZ then error "expected integer matrix";
header := toString(numRows M | " " | numcols M);
e := entries M;
es := for e1 in e list for a in e1 list (toString a | " ");
s := concatenate between("\n", es);
header | "\n" | s | "\n"
)

runPoly = method()
-- runPoly(Matrix, String) := (M, opts) -> (
-- "foo" << palpMatrix M << close;
-- cmd := "poly.x -" | opts | " foo";
-- runProgram(PALP, cmd)
-- )

runPoly(Matrix, String) := (M, opts) -> (
"foo" << palpMatrix M << close;
cmd := " -" | opts | " foo";
result := runProgram(polyx, cmd);
matrix KSEntry result#"output"
)


runPoly(Matrix, String) := String => (M, opts) -> (
"foo" << palpMatrix M << close;
cmd := " -" | opts | " foo";
result := runProgram(polyx, cmd);
result#"output"
)

normalForm = method()
normalForm Matrix := Matrix => (M) -> (
"foo" << palpMatrix M << close;
cmd := " -N foo";
result := runProgram(polyx, cmd);
matrix KSEntry result#"output"
)

-* Documentation section *-
beginDocumentation()

end--

doc ///
Key
PALPInterface
Headline
Description
Text
Tree
Example
CannedExample
Acknowledgement
Contributors
References
Caveat
SeeAlso
Subnodes
///

doc ///
Key
Headline
Usage
Inputs
Outputs
Consequences
Item
Description
Text
Example
CannedExample
Code
Pre
ExampleFiles
Contributors
References
Caveat
SeeAlso
///

-* Test section *-
TEST /// -* [insert short title for this test] *-
-- test code and assertions here
-- may have as many TEST sections as needed
///

end--

-* Development section *-
restart
debug needsPackage "PALPInterface"
check "PALPInterface"

uninstallPackage "PALPInterface"
restart
installPackage "PALPInterface"
viewHelp "PALPInterface"

restart
debug needsPackage "PALPInterface"
M = matrix{{1,1,1,1},{0,1,2,3}}
palpMatrix M
"foo" << palpMatrix M << close
runPoly(M, "v")
needsPackage "StringTorics"
matrix
normalForm M
viewHelp runProgram

needsPackage "StringTorics"
kss = kreuzerSkarke(7, Limit => 10)

L = vertices polar convexHull matrix kss_7
L = sub(L, ZZ)
L1 = normalForm L

first lines runPoly(L1, "g") -- informational line
runPoly(L1, "p")
runPoly(L1, "v")
runPoly(L1, "e")
runPoly(L1, "m")
runPoly(L1, "d")
runPoly(L1, "a")
runPoly(L1, "D")
runPoly(L1, "i")
runPoly(L1, "I")
runPoly(L1, "S")
runPoly(L1, "Tv")
runPoly(L1, "Tp")
runPoly(L1, "N")
runPoly(L1, "t")
13 changes: 13 additions & 0 deletions CYToolsM2/installThese.m2
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,16 @@ restart
check "IntegerEquivalences"
check "StringTorics"
check "DanilovKhovanskii"

-- PALP interface
-- for now, need to install PALP on your computer to use this.
restart
uninstallPackage "PALPInterface"
restart
needsPackage "PALPInterface"
restart
installPackage "PALPInterface" -- no documentation or tests at all
check "PALPInterface"

-- We can make a similar interface to GV invariants?
-- maybe called GromovWitten or GVInvariants.

0 comments on commit bf6961a

Please sign in to comment.