// This is a C program that will be used to calculate the valid colorings of a tangle. // The program will be passed a braid. A one dimensional zero indexed array. This program // will use the first two strands for the tangle. The other strands will be closed as usual. // The strands used for the tangle will all have the same color if the coloring is valid. // //10/14/05 //return numbcolors, typecase to short //8_1_05 removed some unnecessary variables. Changed some declaration to // short int. removed typecase to validCvecs assignment. Removed validCvecs[0]. // Indexed validCvecs to 1 not brind*(nopsknot+1). #include #include int eqarray(short int *A,short int *B, int nops); int validcolorvectorsint(short *quandle, int quandlesize, short *knot, int braidindex, int nopsknot, short *validCvecs){ short quandleinv[quandlesize*quandlesize]; int temp; int tempscript=0; int numbcolors=0; // int count=1; int k; int contcoloring=0; short int color[nopsknot+2][braidindex]; // goes 1 to brind short int carryover[braidindex+2]; short int temparray[braidindex+2]; int colordiff=0; int i,j,h,jj,kk; // int helpme,ht; int nCo=0; for(i=0;i 0){ for(h=1; h<=braidindex;h++){ if( h==abs(knot[j-1])) color[j+1][h]=color[j][h+1]; if( h==(abs(knot[j-1])+1)) color[j+1][h]=quandle[color[j][h-1]*quandlesize+color[j][h]]; if( h(abs(knot[j-1])+1)) color[j+1][h]=color[j][h]; } } else{ for(h=1; h<=braidindex;h++){ if( h==abs(knot[j-1])) color[j+1][h]=quandleinv[color[j][h]*quandlesize+color[j][h+1]]; if( h==(abs(knot[j-1])+1)) color[j+1][h]=color[j][h-1]; if( h(abs(knot[j-1])+1)) color[j+1][h]=color[j][h]; } } } colordiff=0; colordiff=eqarray(color[1],color[nopsknot+1],braidindex); if(colordiff){ // validCvecs[0]++; // printf("\n\n"); for(jj=1;jj<=nopsknot+1;jj++){ for(kk=1;kk<=braidindex;kk++){ // printf("%d ",color[jj][kk]); tempscript=numbcolors*(nopsknot+1)*braidindex+((jj-1)*braidindex+kk); validCvecs[tempscript]= color[jj][kk]; } // printf("\n\n"); } numbcolors++; nCo++; } contcoloring=eqarray( color[1], temparray,braidindex); do{ color[1][1]=color[1][1]+1; // color[1][2]=color[1][2]+1; k=1; // color[1][1]=color[1][2]; carryover[k]= color[1][k]/quandlesize; while(carryover[k]!=0&&k