gen_fun: add substitute method.
[barvinok.git] / cdd2polylib.pl
bloba745d7cebdfc243cc24aebc3d2bba33ab35e3f03
1 #!/usr/bin/perl
2 use strict;
4 my $line = <>;
5 my ($r, $c) = split ' ', $line;
6 my @M;
7 for (1..$r) {
8 $line = <>;
9 chomp $line;
10 my @v = split ' ', $line;
11 push @v, $v[0];
12 $v[0] = 1;
13 push @M, [@v];
15 while (<>) {
16 chomp;
17 my @v = split;
18 if ($v[0] eq 'linearity') {
19 shift @v;
20 shift @v;
21 for (@v) {
22 $M[$_-1][0] = 0;
25 elsif ($v[0] eq 'nonnegative') {
26 shift @v;
27 shift @v;
28 for (@v) {
29 push @M, [1, map { ; 0 } (1..$c)];
30 $M[-1][$_] = 1;
35 print $#M+1, " ", $#{$M[0]}+1, "\n";
36 for (@M) {
37 print join(' ', @$_), "\n";