10 use "factorization-coords"
21 var seed : uint32 = (std.now() : uint32)
22 var fast_mutations : bool = false
25 .argdesc = "([clav | latex]-[Q | Qdv | Qdh] | print-M | [print | test]-[murot | muflip ])",
29 [ .opt = 'g', .arg = "group", .desc = "something like ‘F4’ or ‘B10’", .optional = false ],
30 [ .opt = 'f', .desc = "when testing mutations, skip reordering", .optional = true ],
31 [ .opt = 'S', .arg = "seed", .desc = "Something like ‘0x123’ or ‘101’", .optional = true],
34 var cmd = std.optparse(args, &optdef)
39 match parse_KC_type(s)
41 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
43 | ('f', _): fast_mutations = true
46 | `std.Some x: seed = x
47 | `std.None: std.fatal("{}: Cannot parse seed ‘{}’\n", s)
54 if std.eq(arg, "clav-Q")
56 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
57 | `std.Ok q: std.put("{}\n", quiver.to_bytes(q))
59 elif std.eq(arg, "latex-Q")
61 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
62 | `std.Ok q: std.put("{}\n", latex_from_quiver(q))
64 elif std.eq(arg, "clav-Qdv")
66 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
67 | `std.Ok Qdv: std.put("{}\n", quiver.to_bytes(Qdv))
69 elif std.eq(arg, "latex-Qdv")
71 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
72 | `std.Ok Qdv: std.put("{}\n", latex_from_quiver(Qdv))
74 elif std.eq(arg, "clav-Qdh")
76 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
77 | `std.Ok Qdh: std.put("{}\n", quiver.to_bytes(Qdh))
79 elif std.eq(arg, "latex-Qdh")
81 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
82 | `std.Ok Qdh: std.put("{}\n", latex_from_quiver(Qdh))
84 elif std.eq(arg, "print-murot")
88 mures = get_mutwistingrot(kc)
94 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
98 std.put(" {}", vertex)
102 elif std.eq(arg, "print-muflip")
106 mures = get_mutwistingflip(kc)
108 mures = get_muflip(kc)
112 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
116 std.put(" {}", vertex)
120 elif std.eq(arg, "print-M")
122 match get_coxeter_elt(kc)
123 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
134 match get_sigmaG_permutation(kc)
135 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
136 | `std.Ok perm: sigmaG = perm
138 for var j = 0; j < rank; ++j
141 .c = std.try(yakmo.ratfuncfromS(std.fmt("h1{}", c[j]), "1")),
145 .c = std.try(yakmo.ratfuncfromS(std.fmt("h2{}", c[j]), "1")),
149 .c = std.try(yakmo.ratfuncfromS(std.fmt("h3{}", c[j]), "1")),
152 for var j = rank + 1; j <= m; ++j
155 .c = std.try(yakmo.ratfuncfromS(std.fmt("g{}", j), "1")),
159 var alpha : conf_3_star = [ .h1 = h1, .h2 = h2, .h3 = h3, .u = u ]
160 var d = get_trivial_Dynkin_automorphism(kc)
162 match apply_M(kc, &alpha, d)
163 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
164 | `std.Ok (lT_Q, _): T_Q0 = lT_Q
167 std.put("A : {}\n", T_Q0.A[1:])
168 std.put("B : {}\n", T_Q0.B[1:])
169 std.put("C : {}\n", T_Q0.C[1:])
171 var h = coxeter_num(kc)
172 var trivial : yakmo.ratfunc# = yakmo.rid()
174 for var j = 1; j < (h / 2); ++j
176 yakmo.reduceratfunc(T_Q0.v[i][j])
178 var name = vname(i, j)
179 std.put("{w=8} : {}", name, T_Q0.v[i][j])
183 elif std.eq(arg, "test-murot")
184 match numerically_test_rotate(kc, seed, fast_mutations)
185 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
188 elif std.eq(arg, "test-muflip")
189 match numerically_test_flip(kc, seed, fast_mutations)
190 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
193 elif std.eq(arg, "variables-murot")
195 undocumented -- probably not of use to anyone else.
197 Print the intermediate Laurent polynomials
198 describing the quiver mutation corresponding
199 to murot. TODO: now that you have code for
200 Laurent polynomials, use those instead.
204 mures = get_mutwistingrot(kc)
206 mures = get_murot(kc)
210 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
213 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
215 expound_mutation(q, mu)
218 elif std.eq(arg, "print-cartan-matrix")
220 undocumented -- probably not of use to anyone else
222 Print the Cartan matrix for g. Useful for
223 checking whether conventions agree.
225 var A = get_cartan_matrix(kc)
229 std.put(" {w=2,p= }", val)
233 elif std.eq(arg, "print-sigmaG")
235 undocumented -- probably not of use to anyone else
237 Print the Cartan matrix for g. Useful for
238 checking whether conventions agree.
240 std.put("σG = {}\n", std.try(get_sigmaG_permutation(kc)))
241 elif std.eq(arg, "print-bkl")
243 undocumented -- probably not of use to anyone else
245 Print the matrix for ⟨γ_k, (a^i_l)^v⟩ in
246 terms of k and l. Useful for converting
247 between minor coordinates and factorization
251 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
253 var text : byte[:][:][:] = [][:]
255 for var k = 0; k < bkl.len; ++k
257 for var l = 0; l < bkl[k].len; ++l
258 var this_entry = std.fmt("{}", bkl[k][l])
259 max_width = std.max(max_width, this_entry.len)
260 std.slpush(&this_row, this_entry)
262 std.slpush(&text, this_row)
264 var fmt = std.fmt(" {{w={},p= }} ", max_width)
266 for var k = 0; k < max_width + 2; ++k
267 std.slpush(&dashes, ('-' : byte))
269 std.put(" ⟨γ_k, (a^i_l)^v⟩ :\n")
272 for var l = 0; l < bkl[0].len; ++l
278 for var l = 0; l < bkl[0].len; ++l
279 std.put("{}", dashes)
283 for var k = 0; k < bkl.len; ++k
284 std.put(" {w=4,p= } |", k + 1)
285 for var l = 0; l < bkl[0].len; ++l
286 std.put(fmt, text[k][l])
291 elif std.eq(arg, "test-bkl")
293 undocumented -- probably not of use to anyone else
295 Test that my formula for ⟨γ_k, (a^i_l)^v⟩ has
301 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
302 | `std.Ok bkl: right_bkl = bkl
304 match predict_bkl(kc)
305 | `std.Err e: std.fatal("{}: Error: {}\n", cmd.prog, e)
306 | `std.Ok bkl: predicted_bkl = bkl
309 var right_text : byte[:][:][:] = [][:]
310 var predicted_text : byte[:][:][:] = [][:]
312 var good_color = "\u{001b}[48;2;12;55;55m"
313 var bad_color = "\u{001b}[48;2;85;12;12m"
314 var end_color = "\u{001b}[0m"
315 for var k = 0; k < right_bkl.len; ++k
316 var right_row = [][:]
317 var predicted_row = [][:]
318 for var l = 0; l < right_bkl[k].len; ++l
319 var right_entry = std.fmt("{}", right_bkl[k][l])
320 var predicted_entry = std.fmt("{}", predicted_bkl[k][l])
321 max_width = std.max(max_width, right_entry.len)
322 max_width = std.max(max_width, predicted_entry.len)
323 std.slpush(&right_row, right_entry)
324 std.slpush(&predicted_row, predicted_entry)
326 std.slpush(&right_text, right_row)
327 std.slpush(&predicted_text, predicted_row)
329 var fmt = std.fmt(" {{w={},p= }} ", max_width)
331 for var k = 0; k < max_width + 2; ++k
332 std.slpush(&dashes, ('-' : byte))
334 std.put(" ⟨γ_k, (a^i_l)^v⟩ :\n")
336 for text : [right_text, predicted_text][:]
338 for var l = 0; l < right_bkl[0].len; ++l
344 for var l = 0; l < right_bkl[0].len; ++l
345 std.put("{}", dashes)
349 for var k = 0; k < right_bkl.len; ++k
350 std.put(" {w=4,p= } |", k + 1)
351 for var l = 0; l < right_bkl[0].len; ++l
352 if std.eq(right_bkl[k][l], predicted_bkl[k][l])
357 std.put(fmt, text[k][l])
364 elif std.eq(arg, "print-fc-from-mc")
366 undocumented -- probably not of use to anyone else
368 Given interior minor coordinates u1, u2, ...,
369 compute the formula for each factorization
372 var mc : minor_coordinate[:] = [][:]
373 var w0 : weyl_reflection[:] = get_w0(kc)
374 for var k = 1; k <= w0.len; ++k
375 std.slpush(&mc, [ .k = k, .c = std.try(yakmo.ratfuncfromS(std.fmt("u{}", k), "1")) ])
378 match interior_fc_from_mc(kc, mc)
379 | `std.Err e: std.put("interior_fc_from_mc: {}\n", e)
381 for var k = 0; k < fc.len; ++k
383 | `X(_, expr): std.put("t{} = {}\n", k + 1, expr)
384 | _: std.put("t{} was {}, should have been some x_i(...)\n", k + 1, fc[k])
388 elif std.eq(arg, "print-mc-from-fc")
390 undocumented -- probably not of use to anyone else
392 Given interior factorization coordinates t1,
393 t2, ..., compute the formula for each minor
396 var fc : factorization_coordinate[:] = [][:]
397 var w0 : weyl_reflection[:] = get_w0(kc)
398 for var k = 1; k <= w0.len; ++k
399 std.slpush(&fc, `X(w0[k - 1], std.try(yakmo.ratfuncfromS(std.fmt("t{}", k), "1"))))
402 match interior_mc_from_fc(kc, fc)
403 | `std.Err e: std.put("interior_mc_from_fc: {}\n", e)
405 for var k = 0; k < mc.len; ++k
406 std.put("u{} = {}\n", mc[k].k, mc[k].c)
411 std.optusage(cmd.prog, &optdef)