-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.pl
More file actions
66 lines (54 loc) · 1.03 KB
/
lib.pl
File metadata and controls
66 lines (54 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use application "topaz";
## Common functions
my $r2m = "ReginaToPolymake.py";
my $censusfile = "../Census6Pentachora/4Pentachora/no_spheres.sig";
my $outpath = "output";
my $xmlpath = "xml";
if (! -d $outpath ) {
mkdir $outpath;
}
if (! -d $xmlpath ) {
mkdir $xmlpath;
}
sub is_m_sequence {
my $h0 = shift;
$h0 == 1 or return 0;
my $prev = shift;
my $counter = 1;
foreach (@_) {
$_ >= 0 or return 0;
if ($_ > 0 and $_ > polytope::pseudopower($prev,$counter)) {
return 0;
}
$prev = $_;
$counter++;
}
return 1;
}
sub g_vector {
## calculates g-vector from supplied h-vector
my @hv = @{shift @_};
my @g;
my $size = $#hv / 2;
my $prev = shift @hv;
push (@g, $prev);
foreach (@hv) {
if ($#g > $size - 1) {
last;
}
push(@g, $_ - $prev);
$prev = $_;
}
return @g;
}
sub gen_simp_comp {
my $regdesc = shift;
my $out = "$xmlpath/$regdesc.xml";
if (! -e $out) {
system("regina-python $r2m $regdesc $out");
}
my $p=load_data($out);
my $q=new SimplicialComplex(INPUT_FACES=>$p);
return $q;
}
1;