# How to use ren

Ren lets you create random tilings of weighted aztec diamonds, as well as compute all their edge probabilities and enumerate the number of matchings of them.

First you have to create an input file of a special format. Rotate the aztec diamond so it looks like this. Notice if we put the weights of the edges on the appropriate edges, they would fit in a square grid, which is good for an input format.

```  o   o   o
/ \ / \ / \
o   o   o   o
\ / \ / \ /
o   o   o
/ \ / \ / \     (here is an order 3 weighted aztec diamond)
o   o   o   o
\ / \ / \ /
o   o   o
/ \ / \ / \
o   o   o   o
\ / \ / \ /
o   o   o
```

The first line of the input file has the order of the aztec diamond, and the rest of the lines has the respective weights of edges, alternating N,E,N,E on the odd number lines and W,S,W,S on the even lines like

```[order]
N E N E
W S W S
N E N E
W S W S
```

Given a bipartite graph without any odd area holes, you can embed it into an aztec diamond of sufficiently high order. I'll show an example of an order 2 hexagon.

```                ..
....
......
........
AVAVA      AVAVA.....
AVAVAVA    AVAVAVA.....
VAVAVAV    VAVAVAV.....
VAVAV      VAVAV.....
........
......
....
..

```
The pattern of dots can be matched in at least one way, so this embedding works. To use ren to handle this hexagon, we get the weights of the hexagon (which are 1 for a present edge and 0 for an edge that isn't there) and insert zero-weight edges where the dots are. The corresponding array of numbers given to ren will be

```5
1 1 1 1 0 0 0 0 0 0
1 0 1 0 1 0 0 0 0 0
1 1 1 1 1 1 0 0 0 0
1 0 1 0 1 0 1 0 0 0
0 1 1 1 1 1 1 0 0 0
0 0 1 0 1 0 1 0 0 0
0 0 0 1 1 1 1 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
```
The program wt2vax creates a pattern of weights from an aztec diamond of the following format (same as vaxrandom, drawtiling, etc...)
```#Creator: drawtiling.c
#Vax file
#Title: weighted aztec diamond
6 6
##
####
######
######
####
##
```
where # is any VAX character. Note a space is a valid VAX character whose four weights (N,E,S,W) are all 0.

I can easily embed the hexagon into an aztec diamond simply by shifting it with spaces. For the order 2, shift it three spaces down and it fits inside an order 5 aztec diamond.

It turns out that all of the regions we have studied so far allow us to use this trick. They can be shifted over to fit inside an aztec diamond. First make the region with drawtiling, shift it the appropriate amount with shift.pl, and then you can use ren on it. But first, a little table of shifts would be useful here.

 Region Shift in X Shift in Y Order of Aztec diamond Aztec diamond 0 0 n Hexagon 0 2n-1 3n-1 Fortress 0 n 2n Aztec dungeon 0 2n 4n Hexagonal dungeon 5n-3 4n-2 9n-4 Square n n 2n
A summary of steps to get a random tiling is:

• drawtiling -[regiontype] [order] > reg.vax
• shift.pl [dx] [dy] [order] reg.vax > reg.vax2
• vax2wt reg.vax2 > reg.wt
• renfpd < reg.wt > reg.ranwt
• wt2vax reg.ranwt [order] > reg.ranvax

reg.ranvax is the tiling of the weighted aztec diamond. However, if we want to strip all of the edges we added (of weight 0 so they don't affect the rest of the tiling), we use findarctic, and then we can run printtiling to get the postscript picture.

• findarctic reg.vax2 reg.ranvax reg.ranvax -intersect > reg.ran
• printtiling reg.ran -[tiletype] > reg.ps

## Compiling ren

Compiling ren.c is tricky because it handles different options on the compile line and also requires the GNU GMP library. To compile ren, you have three choices:

• gcc -o ren ren.c r250.c
• gcc -DDOUB -o ren ren.c r250.c
• gcc -DINF -o ren ren.c r250.c -lgmp

The first will produce floating point code with normal single precision arithmetic; the second will use double precision; and the third will use exact arithmetic (infinitely precise since it uses fractions instead of floating point numbers).

At MIT, you have to remember to type "add mathlibrary" and then you have to tell the compiler where to find the libraries by specifying "-I/mit/mathlibrary/include" and "-L/mit/mathlibrary/lib". Finally, you want to specify "-O3" to use full optimization at compile time.

An example of the full steps you have to carry out is as follows:

```athena% add mathlibrary
athena% gcc -O3 -DINF -I/mit/mathlibrary/include -L/mit/mathlibrary/lib -o\
renex ren.c r250.c -lgmp
```

## Using ren.c

Ren.c has a couple obfuscated command line arguments which work as follows:

The numbers in the grid represent the weights of the corresponding edges of the Aztec diamond graph rotated 45 degrees. For this example, let az4.dat be the weights for an order 4 aztec diamond.

• "ren 1 < az4.dat > result" will output the sum of weights of matchings for an Aztec diamond graph of order 4;
• "ren 2 < az4.dat > result" will output the edge probabilities;
• "ren 4 < az4.dat > result" will output a random tiling;

Sum 1,2 and 4 to get a combination of the above. For example, "ren 5 < az4.dat > result" will output the sum of weights of matchings, followed by a random tiling. This scheme allows you to have any set of options included in your output.

If you have any questions or comments, send an email to mdblum@yahoo.com or haraldh@math.Princeton.EDU .