/* This program outputs the definition of a matrix whose determinant is
* the number of domino tilings of the input region (up to a factor of
* some power of i). The matrix should be fed to Mathematica. This
* input format allows for computing the number of matchings of any
* bipartite planar graph.
*
* The region should be given as a pattern of V's, A's, <'s, >'s, and X's.
* All characters after a percent are ignored. Currently, the input must
* fit in a rectangle with 500 rows and 200 columns.
*
* You can compile the program with the Unix command
*
* cc vaxmathematica.c -o vaxmathematica
*
* There is supposedly a way to run Mathematica in command-line mode;
* if so, Unix users might be able to pipe the output of vaxmathematica
* to a Mathematica kernel. Otherwise, you'll have to settle for a
* two-stage process: use vaxmathematica to create Mathematica code
* and then copy and paste that code into a Mathematica window.
*
* Greg Kuperberg, Jim Propp, and David Wilson
*/
#include
#define WIDTH 202
#define LENGTH 502
#define FREE -1
char pict[LENGTH][WIDTH];
int p[LENGTH][WIDTH];
char gap[LENGTH][WIDTH];
int main()
{
int i,j,k;
int rows,columns;
for (i=0; i