Computation of the Jones polynomial

This commit is contained in:
Wojciech Politarczyk 2016-11-19 20:46:39 +01:00
parent 4fdd08f1d1
commit df8f02f3ca
5 changed files with 56 additions and 11 deletions

4
.gitignore vendored
View File

@ -1,5 +1,9 @@
#*
*~ *~
*.o *.o
GPATH
GRTAGS
GTAGS
/kk /kk
/main /main
/testsurfaces /testsurfaces

View File

@ -4,9 +4,9 @@ devel = 1
BISON = bison BISON = bison
FLEX = flex 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 = 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 INCLUDES = -I. -I/opt/local/include

View File

@ -155,7 +155,7 @@ class Z
return mpz_divisible_p (num.impl->x, impl->x); return mpz_divisible_p (num.impl->x, impl->x);
} }
bool operator | (const Z &num) const { return divides (num); } bool operator | (const Z &num) const { return divides (num); }
Z divide_exact (const Z &denom) const Z divide_exact (const Z &denom) const
{ {
// num = *this // num = *this

55
kk.cpp
View File

@ -251,6 +251,37 @@ compute_gss ()
tex_footer (); tex_footer ();
} }
multivariate_laurentpoly<Q> compute_jones(const knot_diagram& k, bool reduced) {
cube<Z2> c(kd, reduced);
multivariate_laurentpoly<Q> 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<Q>(1, VARIABLE, 1, gr.q);
}
else {
jones += multivariate_laurentpoly<Q>(-1, VARIABLE, 1, gr.q);
}
}
return jones;
}
void compute_khp(const knot_diagram& k, bool reduced) {
cube<Z2> c(kd,reduced);
ptr<const module<Z2> > C = c.khC;
mod_map<Z2> d = c.compute_d(1, 0, 0, 0, 0);
chain_complex_simplifier<Z2> s(C, d, maybe<int>(1), maybe<int>(0));
C = s.new_C;
d = s.new_d;
C->show_self();
//multivariate_laurentpoly<Q> khp;
//for(uint i = 1; i <= c.n_generators; ++i) {
// grading gr = c.compute_generator_grading(i);
// khp += multivariate_laurentpoly<Q>(1, VARIABLE, gr.h, gr.q);
//}
printf("The Poincare polynomial \n");
}
template<class R> void template<class R> void
compute_invariant () compute_invariant ()
{ {
@ -663,12 +694,12 @@ main (int argc, char **argv)
kd = parse_knot (knot); kd = parse_knot (knot);
kd.marked_edge = 1; kd.marked_edge = 1;
if (!strcmp (invariant, "gauss")) if (!strcmp (invariant, "gauss"))
{ {
basedvector<basedvector<int, 1>, 1> gc = kd.as_gauss_code (); basedvector<basedvector<int, 1>, 1> gc = kd.as_gauss_code ();
for (unsigned i = 1; i <= gc.size (); i ++) for (unsigned i = 1; i <= gc.size (); i ++)
{ {
if (i > 1) if (i > 1)
printf (":"); printf (":");
for (unsigned j = 1; j <= gc[i].size (); j ++) for (unsigned j = 1; j <= gc[i].size (); j ++)
@ -701,6 +732,18 @@ main (int argc, char **argv)
compute_gss (); compute_gss ();
} }
else if(!strcmp(invariant, "jones")) {
multivariate_laurentpoly<Q> 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<Q> jones_pol = compute_jones(kd, reduced);
}
else if(!strcmp(invariant, "khp")) {
compute_khp(kd, reduced);
}
else else
{ {
if (!strcmp (field, "Z2")) if (!strcmp (field, "Z2"))

View File

@ -1,8 +1,6 @@
#include <knotkit.h> #include <knotkit.h>
#define HOME "/Users/josh/Documents/code/knotkit/"
bool verbose = 0; bool verbose = 0;
static const struct { static const struct {