repo.or.cz
/
barvinok.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
doc: primal decomposition: typo fixes + clarifications
[barvinok.git]
/
latte2polylib.pl
blob
a745d7cebdfc243cc24aebc3d2bba33ab35e3f03
1
#!/usr/bin/perl
2
use
strict
;
3
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
];
14
}
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
;
23
}
24
}
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
;
31
}
32
}
33
}
34
35
print
$#M
+
1
,
" "
, $
#{$M[0]}+1, "\n";
36
for
(
@M
) {
37
print join
(
' '
,
@
$_
),
"
\n
"
;
38
}