diff --git a/.gitignore b/.gitignore index 7695f4a..093d3f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ +#* *~ *.o +GPATH +GRTAGS +GTAGS /kk /main /testsurfaces diff --git a/Makefile b/Makefile index 9d24f87..8340db3 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,9 @@ devel = 1 BISON = bison FLEX = flex -# CXX = g++ +CXX = g++ -std=c++11 # CXX = OMPI_CXX=clang++ mpic++ -fno-color-diagnostics --stdlib=libc++ --std=c++11 -I/u/cseed/llvm-3.1/lib/c++/v1 -CXX = clang++ -fno-color-diagnostics --stdlib=libc++ --std=c++11 +#CXX = clang++ -fno-color-diagnostics --stdlib=libc++ --std=c++11 INCLUDES = -I. -I/opt/local/include diff --git a/algebra/Z.h b/algebra/Z.h index d23c0fc..8478ebf 100644 --- a/algebra/Z.h +++ b/algebra/Z.h @@ -155,7 +155,7 @@ class Z return mpz_divisible_p (num.impl->x, impl->x); } bool operator | (const Z &num) const { return divides (num); } - + Z divide_exact (const Z &denom) const { // num = *this diff --git a/kk.cpp b/kk.cpp index 484b547..ba9e72a 100644 --- a/kk.cpp +++ b/kk.cpp @@ -251,6 +251,37 @@ compute_gss () tex_footer (); } +multivariate_laurentpoly compute_jones(const knot_diagram& k, bool reduced) { + cube c(kd, reduced); + multivariate_laurentpoly jones; + for(uint i = 1; i <= c.n_generators; ++i) { + grading gr = c.compute_generator_grading(i); + if(gr.h % 2 == 0) { + jones += multivariate_laurentpoly(1, VARIABLE, 1, gr.q); + } + else { + jones += multivariate_laurentpoly(-1, VARIABLE, 1, gr.q); + } + } + return jones; +} + +void compute_khp(const knot_diagram& k, bool reduced) { + cube c(kd,reduced); + ptr > C = c.khC; + mod_map d = c.compute_d(1, 0, 0, 0, 0); + chain_complex_simplifier s(C, d, maybe(1), maybe(0)); + C = s.new_C; + d = s.new_d; + C->show_self(); + //multivariate_laurentpoly khp; + //for(uint i = 1; i <= c.n_generators; ++i) { + // grading gr = c.compute_generator_grading(i); + // khp += multivariate_laurentpoly(1, VARIABLE, gr.h, gr.q); + //} + printf("The Poincare polynomial \n"); +} + template void compute_invariant () { @@ -663,12 +694,12 @@ main (int argc, char **argv) kd = parse_knot (knot); kd.marked_edge = 1; - - if (!strcmp (invariant, "gauss")) - { - basedvector, 1> gc = kd.as_gauss_code (); - for (unsigned i = 1; i <= gc.size (); i ++) - { + + if (!strcmp (invariant, "gauss")) + { + basedvector, 1> gc = kd.as_gauss_code (); + for (unsigned i = 1; i <= gc.size (); i ++) + { if (i > 1) printf (":"); for (unsigned j = 1; j <= gc[i].size (); j ++) @@ -701,6 +732,18 @@ main (int argc, char **argv) compute_gss (); } + else if(!strcmp(invariant, "jones")) { + multivariate_laurentpoly jones_pol = compute_jones(kd, reduced); + printf("Jones polynomial of %s is equal to:\n", knot); + jones_pol.show_self(); + printf("\n"); + } + else if(!strcmp(invariant, "przytycki_cong")) { + multivariate_laurentpoly jones_pol = compute_jones(kd, reduced); + } + else if(!strcmp(invariant, "khp")) { + compute_khp(kd, reduced); + } else { if (!strcmp (field, "Z2")) diff --git a/knot_tables.cpp b/knot_tables.cpp index 3733799..1a4ebce 100644 --- a/knot_tables.cpp +++ b/knot_tables.cpp @@ -1,8 +1,6 @@ #include -#define HOME "/Users/josh/Documents/code/knotkit/" - bool verbose = 0; static const struct {