From a0f94aad4735361f9be4664524e989615d0cac88 Mon Sep 17 00:00:00 2001 From: Cotton Seed Date: Fri, 4 May 2012 08:27:09 -0400 Subject: [PATCH] Fixed bug in writer::write_mod. Added (partial) support for comparing sq1/2 to main. --- algebra/module.h | 2 +- main.cpp | 169 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 134 insertions(+), 37 deletions(-) diff --git a/algebra/module.h b/algebra/module.h index 6ae0f87..5ac0ac9 100644 --- a/algebra/module.h +++ b/algebra/module.h @@ -1992,7 +1992,7 @@ mod_map::display_self () const template void writer::write_mod (ptr > m) { - pair p = aw->id_io_id.find (m->id_counter); + pair p = aw->id_io_id.find (m->id); if (p.second) { write_int ((int)p.first); diff --git a/main.cpp b/main.cpp index 5c884a5..566b553 100644 --- a/main.cpp +++ b/main.cpp @@ -204,15 +204,13 @@ compute_show_kh_sq (knot_desc desc void load (map, - multivariate_laurentpoly, - multivariate_laurentpoly > > &knot_kh_sq, + pair, mod_map > > &knot_kh_sq, knot_desc desc) { char buf[1000]; if (desc.t == knot_desc::TORUS) { - sprintf (buf, "kh_sq/T.dat"); + sprintf (buf, "knot_kh_sq/T.dat"); } else { @@ -221,64 +219,163 @@ load (map, - multivariate_laurentpoly, - multivariate_laurentpoly > > m (r); + pair, mod_map > > m (r); for (map, - multivariate_laurentpoly, - multivariate_laurentpoly > >::const_iter i = m; i; i ++) + pair, mod_map > >::const_iter i = m; i; i ++) { - // ??? check computations agree!! - if (! (knot_kh_sq % i.key ())) - { -#if 0 - assert (i.key ().t == desc.t); - assert (i.key ().i == desc.i); - assert (desc.j <= i.key ().j); - assert (i.key ().j <= desc.j + 4000); - - if (i.key ().t == knot_desc::MT - && i.key ().i == 11 - && (i.key ().j == 862 - || i.key ().j == 865)) - compute_show_kh_sq (i.key (), - i.val ().first, - i.val ().second, - i.val ().third); -#endif - - knot_kh_sq.push (i.key (), i.val ()); - } + knot_kh_sq.push (i.key (), i.val ()); } printf ("done.\n"); } +static const int block_size = 100; + int main () { #if 0 - knot_diagram kd (rolfsen_knot (8, 19)); + map, mod_map > > knot_kh_sq; + + for (unsigned i = 12; i >= 1; i --) + { + if (i <= 10) + { + for (unsigned j = 1; j <= rolfsen_crossing_knots (i); j += block_size) + { + load (knot_kh_sq, knot_desc (knot_desc::ROLFSEN, i, j)); + } + } + + for (unsigned j = 1; j <= htw_knots (i); j += block_size) + { + load (knot_kh_sq, knot_desc (knot_desc::HTW, i, j)); + } + + if (i <= 13) + { + for (unsigned j = 1; j <= mt_links (i); j += block_size) + { + load (knot_kh_sq, knot_desc (knot_desc::MT, i, j)); + } + } + } + + printf ("|knot_kh_sq| = %d\n", knot_kh_sq.card ()); + + for (map, mod_map > >::const_iter i = knot_kh_sq; i; i ++) + { + if (i.key ().t != knot_desc::ROLFSEN) + continue; + + mod_map sq1 = i.val ().first; + mod_map sq2 = i.val ().second; + + display ("sq1:\n", sq1); + display ("sq2:\n", sq2); + + printf ("%s ", i.key ().name ().c_str ()); + + assert (sq1.compose (sq1) == 0); + assert (sq2.compose (sq2) + sq1.compose (sq2).compose (sq1) == 0); + + ptr > H = sq1.domain (); + + map > st; + + bool first = 1; + set gs = H->gradings (); + for (set_const_iter i = gs; i; i ++) + { + grading hq = i.val (), + h1q (hq.h + 1, hq.q), + h2q (hq.h + 2, hq.q); + + // printf ("(%d, %d):\n", hq.h, hq.q); + + ptr > H_hq = H->graded_piece (hq), + H_h1q = H->graded_piece (h1q), + H_h2q = H->graded_piece (h2q); + + mod_map whole = sq2.restrict (H_hq, H_h2q), + tail = sq1.restrict (H_hq, H_h1q), + head = sq1.restrict (H_h1q, H_h2q); + + ptr > whole_im = whole.image (), + tail_ker = tail.kernel (), + head_im = head.image (); + ptr > inter = whole_im->intersection (head_im); + + mod_map whole_res = whole.restrict_from (tail_ker); + ptr > whole_res_im = whole_res.image (); + + ptr > res_inter = whole_res_im->intersection (head_im); + + int r1 = whole_im->dim (); + int r2 = whole_res_im->dim (); + int r3 = inter->dim (); + int r4 = res_inter->dim (); + + if (r1 == 0 + && r2 == 0 + && r3 == 0 + && r4 == 0) + continue; + + // printf (" r = (%d, %d, %d, %d)\n", r1, r2, r3, r4); + +#if 1 + int s1 = r2 - r4, + s2 = r1 - r2 - r3 + r4, + s3 = r4, + s4 = r3 - r4; + + if (first) + first = 0; + else + printf (", "); + printf ("(%d, %d) -> (%d, %d, %d, %d)", + hq.h, hq.q, + s1, s2, s3, s4); +#endif + } + + } +#endif + +#if 1 + knot_diagram kd (rolfsen_knot (5, 2)); show (kd); newline (); cube c (kd); @@ -301,7 +398,7 @@ main () write (w, sq2); #endif -#if 1 +#if 0 #if 0 reader r ("sqtest.dat");