interface(echo = 0, quiet = true, screenwidth = infinity): # This maple script produces hive polytopes ready for input into LattE. # # The purpose of this script is to take each triple of weights from a # list of such triples and to produce the LattE input file for the # Knutson-Tao hive polytope corresponding to that triple of weights. # All the weights in the list must have the same rank. # # To use this program, create a file called "weights" containing triples # of weights, each preceded by a NULL line. The file "weights" should # be in the same directory as this Maple script. This program assumes # that your weights are written in the canonical basis, so that each is # a weakly-decreasing sequence of nonnegative integers. # # Here is an example of the contents of an input file "weights" # containing two triples of weights, each with rank 4: # # NULL # [20, 6, 2, 1] # [20, 12, 11, 8] # [72, 8, 0, 0] # NULL # [19, 19, 16, 12] # [16, 16, 16, 13] # [57, 53, 14, 3] # # Make sure (1) to place a NULL line before every triple -- even the # first one, and (2) *not* to put a new line (LF) at the end of the last # triple in your file. # # After you have created the file "weights", create a folder called # "LattEPolytopes" in the same directory as this Maple file. # # You are now ready to run the maple script by typing # # maple 0 do # Set the interface to the ideal settings for writing to HiveFromMaple # interface(prettyprint = false): # Define (la)mbda, mu, and nu to be the current weights we will # use to generate the hive polytope. # la := parse(readline(weights)): mu := parse(readline(weights)): nu := parse(readline(weights)): # Unassign the values of the a[i,j] assigned the last time # through the while loop. # unassign('a'); # Boundary conditions # BndryEq := [ a[0,0] = 0 ]: # Apex for j from 1 to r do BndryEq := [ op(BndryEq), a[0,j] - a[0,j-1] = la[j] ]; # NE border od: for k from 1 to r do BndryEq := [ op(BndryEq), a[k,r-k] - a[k-1,r-k+1] = mu[k] ]; # S border od: for i from 1 to r do BndryEq := [op(BndryEq), a[i,0] - a[i-1,0] = nu[i] ]; # NW border od: # Rombus inequalities. Note: The equal signs in these lines will # all be interpreted as inequalites <= by LattE, but they are # treated as equalities for now, since this makes them easier to # translate into matrices in Maple. # RombIneq := []: for i from 1 to r do for j from 1 to r-i do RombIneq := [ op(RombIneq), a[i,j-1] + a[i-1,j+1] - a[i,j] - a[i-1,j] = 0, # left rombi a[i,j] + a[i-1,j-1] - a[i,j-1] - a[i-1,j] = 0, # vertical rombi a[i-1,j] + a[i+1,j-1] - a[i,j] - a[i,j-1] = 0 ]; # right rombi od: od: # Produce the matrix A and b such that Ax = b corresponds # to the linear equalities produced above # AllIneq := [ op(BndryEq), op(RombIneq) ]: variables := []: for i from 0 to r do for j from 0 to r-i do variables := [ op(variables), a[i,j] ]; od: od: A := genmatrix(AllIneq, variables, b): # Produce the array (b, -A), denoted bnegA. # bnegA := augment(b,-A): bnegA := convert(bnegA, Matrix): # Create a Latte-readable file (modulo square brackets, commas, and # other such junk) for this system of inequalities # writeto(HiveFromMaple); print(Dimension(bnegA)); print(convert(bnegA, listlist)); print([linearity, nops(BndryEq), seq(i, i=1..nops(BndryEq))]); writeto(terminal): close(HiveFromMaple): # Now make that file really LattE-readable, and print the results to # a file whose file-name expresses la, mu, and nu. # interface(indentamount = 0 , prettyprint = 1): s := readline(HiveFromMaple): news := SubstituteAll(s, ",", " "): t := readline(HiveFromMaple): newt := SubstituteAll(t, "\[\[", ""): newt := SubstituteAll(newt, "\], \[", "\n"): newt := SubstituteAll(newt, ",", " "): newt := SubstituteAll(newt, "\]\]", ""): u := readline(HiveFromMaple): newu := SubstituteAll(u, "\[", ""): newu := SubstituteAll(newu, ",", " "): newu := SubstituteAll(newu, "\]", ""): new := cat(news, "\n", newt, "\n", newu): # Generate the filename for the LattE file that will contain this # hive polytope. # filename := "LattEPolytopes/Ar-": for i from 1 to r-1 do filename := cat(filename, la[i], "."); od: filename := cat(filename, la[r], "_"): for i from 1 to r-1 do filename := cat(filename, mu[i], "."); od: filename := cat(filename, mu[r], "_"): for i from 1 to r-1 do filename := cat(filename, nu[i], "."); od: filename := cat(filename, nu[r]): # Write the hive polytope data in LattE format to the file filename. # writeto(filename): print(convert(new, symbol)); writeto(terminal): close(filename): od: close(weights): # Remove the file HiveFromMaple that was created during this script's # execution. # ! rm HiveFromMaple