Repository navigation
Expand file tree
/
Copy pathfanocats.m2
More file actions
102 lines (86 loc) · 3.67 KB
/
Copy pathfanocats.m2
File metadata and controls
102 lines (86 loc) · 3.67 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
needs "fano.m2"
needsPackage "JSON"
tables = {
2, 3,
(4,2), (4,3), --(4,4), (4,5), (4,6), (4,7), (4,8)
(5,2), (5,3),
(6,2), (6,3)
}
alltables = splice {
apply(4..9, r -> (5,r)),
apply(4..11, r -> (6,r)) -- TODO: 6,12 isn't computed yet!
}
datadir = "~/Projects/M2/fano/_data/"
toJSON Array := o -> L -> if #L == 0 then "[]" else (
concatenate("[", demark_"," apply(L, x -> toJSON(x)), "]"))
storeFanoCatData = method()
storeFanoCatData ZZ := d0 -> (
h0 := selectKeys(new HashTable from ExtTables, (d,i) -> d == d0);
storeFanoCatData(keys h0, "fano-" | d0 | ".json"))
storeFanoCatData(ZZ, ZZ) := (d0, r0) -> (
h0 := selectKeys(new HashTable from ExtTables, (d,i) -> d == d0
and if r0 == 2 then fanoPicardRank(d,i) <= r0 else fanoPicardRank(d,i) == r0);
storeFanoCatData(keys h0, "fano-" | d0 | "-" | r0 | ".json"))
storeFanoCatData(List, String) := (L, name) -> (
h1 := hashTable apply(sort L, (d,i) ->
i => hashTable splice {
X := fano(d,i);
r := fanoPicardRank(d,i);
L := fanoZonotopeDegrees(d,i);
E := if d < 5 or r < 4 or #L <= 10 then ExtTables#(d,i) else id_(ZZ^0);
F := secondaryFan X;
-- TODO: find a cleaner way to find the nef cone
-- as a maximal cone of the secondary fan
C := apply(cols nefGenerators X,
ray -> position(cols rays F, ray' -> ray == ray'));
"rho" => r,
"rays" => [#rays X, toString rays X],
"cones" => [#max X, toString max X],
"theta" => [#L, toExternalString L],
"degs" => toExternalString degrees ring X,
"Ext" => [toExternalString entries E, isExceptional E],
"chambers" => if #chambers X > 100 then #chambers X else toExternalString(
-- TODO: rays in the secondary fan and degs are redundant
entries transpose rays F, unique prepend_C maxCones F,
flatten entries interiorVector dualCone coneFromVData rays F),
"primitive" => toString primitiveCollections X,
});
(datadir | name) << json(h1, Indent => 2, Sort => true) << close)
storeToricCatData = (L, Xs, name) -> (
h1 := hashTable apply(L, Xs, (i, X) ->
i => hashTable splice {
r := rank picardGroup X;
L := zonotopeDegrees X;
E := ExtTableL(X, L);
F := secondaryFan X;
-- TODO: find a cleaner way to find the nef cone
-- as a maximal cone of the secondary fan
C := apply(cols nefGenerators X,
ray -> position(cols rays F, ray' -> ray == ray'));
"rho" => r,
"rays" => [#rays X, toString rays X],
"cones" => [#max X, toString max X],
"theta" => [#L, toExternalString L],
"degs" => toExternalString degrees ring X,
"Ext" => [toExternalString entries E, isExceptional E],
"chambers" => if #chambers X > 100 then #chambers X else toExternalString(
-- TODO: rays in the secondary fan and degs are redundant
entries transpose rays F, unique prepend_C maxCones F,
flatten entries interiorVector dualCone coneFromVData rays F),
"primitive" => toString primitiveCollections X,
});
(datadir | name) << json(h1, Indent => 2) << close)
end--
restart
needs "fanocats.m2"
apply(tables, loadFanoDB)
apply(tables, storeFanoCatData)
apply(alltables, loadFanoDB)
apply(alltables, storeFanoCatData)
primitiveCollections fano(2,3)
storeToricCatData(toList(0..5), apply(6, hirzebruchSurface), "hirzebruch.json")
storeToricCatData(toList(2..11), apply(2..11, Bl2PP'), "Bl2PPn.json")
storeToricCatData(toList(0..40), apply(0..40, variety @@ smallAmpleToricDivisor_2), "small-2D-polytopes.json")
storeToricCatData(toList(0..102), apply(0..102, variety @@ smallAmpleToricDivisor_3), "small-3D-polytopes.json")
storeToricCatData(reverse toList(0..3), apply(reverse(0..3), king), "HillePerling.json")
needs "king.m2"