[BACK]Return to tigers.patch CVS log [TXT][DIR] Up to [local] / OpenXM / src / tigers

Annotation of OpenXM/src/tigers/tigers.patch, Revision 1.3

1.1       maekawa     1: diff -urN TiGERS_0.9.orig/NOTE.txt TiGERS_0.9/NOTE.txt
                      2: --- TiGERS_0.9.orig/NOTE.txt   Thu Jan  1 09:00:00 1970
                      3: +++ TiGERS_0.9/NOTE.txt        Sat Jan  8 07:43:41 2000
                      4: @@ -0,0 +1 @@
                      5: +This is a working directory by NT.  1999, 6/26.
                      6: diff -urN TiGERS_0.9.orig/README.change TiGERS_0.9/README.change
                      7: --- TiGERS_0.9.orig/README.change      Thu Jan  1 09:00:00 1970
                      8: +++ TiGERS_0.9/README.change   Sat Jan  8 07:46:11 2000
                      9: @@ -0,0 +1 @@
                     10: +The original source code of TiGERS is in OpenXM_contib/TiGERS_0.9.
                     11: diff -urN TiGERS_0.9.orig/binomial.c TiGERS_0.9/binomial.c
                     12: --- TiGERS_0.9.orig/binomial.c Sat Jan  8 07:42:43 2000
                     13: +++ TiGERS_0.9/binomial.c      Sat Jan  8 07:43:41 2000
                     14: @@ -12,7 +12,7 @@
                     15:  #include<stdlib.h>
                     16:  #include "utils.h"
                     17:  #include "binomial.h"
                     18: -
                     19: +extern int NT;
                     20:
                     21:  /*
                     22:  **-------------ring defs-----------------------------------------------------
                     23: @@ -98,12 +98,21 @@
                     24:  */
                     25:  void print_monomial(FILE *of, int *exps){
                     26:    int i,jk=0;
                     27: -  for(i=0;i<ring_N;i++){
                     28: -    if (exps[i]!=0){
                     29: -       if (jk!=0) fprintf(of,"*");
                     30: -       else jk=1;
                     31: -       ring_putvar(of,i);
                     32: -       if (exps[i]>1) fprintf(of,"^%d",exps[i]);
                     33: +  if (NT == 1) {
                     34: +    fprintf(of,"[");
                     35: +    for (i=0; i<ring_N; i++) {
                     36: +      fprintf(of,"%d",exps[i]);
                     37: +      if (i != ring_N-1) fprintf(of," , ");
                     38: +    }
                     39: +    fprintf(of,"]");
                     40: +  }else{
                     41: +    for(i=0;i<ring_N;i++){
                     42: +      if (exps[i]!=0){
                     43: +      if (jk!=0) fprintf(of,"*");
                     44: +      else jk=1;
                     45: +      ring_putvar(of,i);
                     46: +      if (exps[i]>1) fprintf(of,"^%d",exps[i]);
                     47: +      }
                     48:      }
                     49:    }
                     50:  }
                     51: @@ -309,17 +318,33 @@
                     52:  **
                     53:  */
                     54:  void binomial_print(FILE *of, binomial b){
                     55: -   if (b==0) fprintf(of,"(NULL)");
                     56: -   else {
                     57: -     if (b->ff==FACET) fprintf(of,"# ");
                     58: -     else if (b->ff==NONFACET) fprintf(of,"! ");
                     59: -     /*else if (b->ff==UNKNOWN) fprintf(of,"? ");*/
                     60: -     print_monomial(of,b->exps1);
                     61: -     if (b->bf==BINOMIAL){
                     62: -      fprintf(of,"-");
                     63: -      print_monomial(of,b->exps2);
                     64: -     }
                     65: -   }
                     66: +  if (NT == 1) {
                     67: +    if (b==0) fprintf(of,"[ ]");
                     68: +    else {
                     69: +      /* if (b->ff==FACET) fprintf(of,"# ");
                     70: +       else if (b->ff==NONFACET) fprintf(of,"! "); */
                     71: +      /*else if (b->ff==UNKNOWN) fprintf(of,"? ");*/
                     72: +      fprintf(of,"[");
                     73: +      print_monomial(of,b->exps1);
                     74: +      if (b->bf==BINOMIAL){
                     75: +      fprintf(of," , ");
                     76: +      print_monomial(of,b->exps2);
                     77: +      fprintf(of,"]");
                     78: +      }
                     79: +    }
                     80: +  }else{
                     81: +    if (b==0) fprintf(of,"(NULL)");
                     82: +    else {
                     83: +      if (b->ff==FACET) fprintf(of,"# ");
                     84: +      else if (b->ff==NONFACET) fprintf(of,"! ");
                     85: +      /*else if (b->ff==UNKNOWN) fprintf(of,"? ");*/
                     86: +      print_monomial(of,b->exps1);
                     87: +      if (b->bf==BINOMIAL){
                     88: +      fprintf(of,"-");
                     89: +      print_monomial(of,b->exps2);
                     90: +      }
                     91: +    }
                     92: +  }
                     93:  }
                     94:
                     95:  /*
                     96: diff -urN TiGERS_0.9.orig/call.c TiGERS_0.9/call.c
1.3     ! ohara      97: --- TiGERS_0.9.orig/call.c     Sat Jun 12 07:05:52 1999
        !            98: +++ TiGERS_0.9/call.c  Wed Dec 15 03:06:28 2004
1.1       maekawa    99: @@ -15,6 +15,8 @@
                    100:  #include "gset.h"
                    101:  #include "matrices.h"
                    102:
                    103: +int NT = 1;
                    104: +
                    105:  /*
                    106:  ** write a description of program usage to stderr
                    107:  */
1.3     ! ohara     108: @@ -68,7 +70,7 @@
        !           109:    exit(-1);
        !           110:  }
        !           111:
        !           112: -FILE *infile=stdin, *outfile=stdout;
        !           113: +FILE *infile, *outfile;
        !           114:  extern int rsearch_cache;
        !           115:  extern int print_tree;
        !           116:  extern int  print_init;
1.1       maekawa   117: @@ -87,7 +89,7 @@
                    118:
                    119:  #define MATFOUND 1
                    120:  #define GSETFOUND 2
                    121: -main(int argc, char **argv ){
                    122: +main2(int argc, char **argv ){
                    123:   char *c,cc, *prog=argv[0], *ifname=0, *ofname=0;
                    124:   int tmp,acnt,stat=0,counter;
                    125:   gset G1=0,gset_toric_ideal();
1.3     ! ohara     126: @@ -100,6 +102,10 @@
        !           127:    print_tree=FALSE;
        !           128:    print_init=FALSE;
        !           129:
        !           130: +  /* added by noro */
        !           131: +  infile = stdin;
        !           132: +  outfile = stdout;
        !           133: +
        !           134:    /* parse command line */
        !           135:    while (--argc > 0 && (*++argv)[0] == '-'){
        !           136:      acnt=0;
        !           137: @@ -205,6 +211,29 @@
1.1       maekawa   138:     }
                    139:    }
                    140:
                    141: +  if (NT == 1) {
                    142: +
                    143: +    fprintf(outfile,"[\n");
                    144: +    /* perform reverse search if desired*/
                    145: +    if (root_only==FALSE){
                    146: +      if (use_exsearch==FALSE){
                    147: +      /* should double check we are at root */
                    148: +      tt=clock();
                    149: +      counter=rsearch(G1);
                    150: +      tt=(clock()-tt)/CLOCKS_PER_SEC;
                    151: +      fprintf(outfile,"\n");
                    152: +      } else {
                    153: +      tt=clock();
                    154: +      counter=exsearch(G1);
                    155: +      tt=(clock()-tt)/CLOCKS_PER_SEC;
                    156: +      fprintf(outfile,"\n");
                    157: +      }
                    158: +    }
                    159: +
                    160: +    fprintf(outfile,"]\n");
                    161: +    goto epilogue ;
                    162: +  }
                    163: +  /* if NT != 1, then start the followings. */
                    164:    /* output first GB if desired */
                    165:    fprintf(outfile,"%% starting GB:\n");
                    166:    fprintf(outfile,"R: %d\n",ring_N);
1.3     ! ohara     167: @@ -314,15 +343,119 @@
1.1       maekawa   168:      return 0;
                    169:      }
                    170:    }
                    171: +
                    172: + epilogue: ;
                    173:    /* clean up */
                    174:    LP_free_space();
                    175:    if (G1!=0) gset_free(G1);
                    176:  }
                    177:
                    178:
                    179: +/************************    NT ***************************/
                    180: +static int findNextToken(char *is, int start)
                    181: +{
                    182: +  if (start == -1) goto endtext ;
                    183: +  while ( is[start] <= ' ') {
                    184: +    if (is[start] == '\0' ) goto endtext ;
                    185: +    start++;
                    186: +  }
                    187: +  while ( is[start] > ' ') {
                    188: +    if (is[start] == '\0') goto endtext ;
                    189: +    start++;
                    190: +  }
                    191: +  while ( is[start] <= ' ') {
                    192: +    if (is[start] == '\0' ) goto endtext ;
                    193: +    start++;
                    194: +  }
                    195: +  return(start);
                    196: + endtext: ;
                    197: +  fprintf(stderr,"findNextToken: end of the text.\n");
                    198: +  return(-1);
                    199: +}
                    200: +int **imatrix_read_from_string(char *is,int *m, int *n) {
                    201: +  char c;
                    202: +  int i,j;
                    203: +  int **M;
                    204: +  int pt = 0;
                    205: +
                    206: +  /*  2 3 :
                    207: +      1 1 1
                    208: +      0 1 2
                    209: +  */
                    210: +  /* read in matrix dimensions and initialize matrix */
                    211: +  sscanf(is,"%d %d :",m,n);
                    212: +  M=new_imatrix(*m,*n);
                    213: +  pt = findNextToken(is,pt); /* n */
                    214: +  pt = findNextToken(is,pt); /* : */
                    215: +
                    216: +  /* read in matrix entrees */
                    217: +  for(i=0;i<*m;i++){
                    218: +    for(j=0;j<*n;j++){
                    219: +      pt = findNextToken(is,pt);
                    220: +      sscanf(&(is[pt]),"%d",&(IMref(M,i,j)));
                    221: +    }
                    222: +  }
                    223: +
                    224: +  return M;
                    225: +}
1.3     ! ohara     226: +
1.1       maekawa   227: +tiger_executeString_M(char *is) {
                    228: +  char *c,cc, *prog="tigers", *ifname=0, *ofname=0;
                    229: +  int tmp,acnt,stat=0,counter;
                    230: +  gset G1=0,gset_toric_ideal();
                    231: +  int **M=0,Mn,Mm;
                    232: +  double tt;
1.3     ! ohara     233: +
1.1       maekawa   234: +  /* initialize parameters */
                    235: +  root_only=FALSE;
                    236: +  rsearch_cache=TRUE;
                    237: +  print_tree=FALSE;
                    238: +  print_init=FALSE;
1.3     ! ohara     239: +
1.1       maekawa   240: +  if ((M=imatrix_read_from_string(is,&Mm,&Mn))==0){
                    241: +     fprintf(stderr,"%s: imatrix_read() failed\n",prog);
                    242: +     exit(1);
                    243: +  }
                    244: +  if (ring_N==0) ring_set(Mn);
                    245: +  else if (ring_N!=Mn) {
                    246: +    fprintf(stderr,"%s: Matrix collum and ring dimensions must agree\n",prog);
                    247: +    exit(1);
                    248: +  }
                    249: +  stat=MATFOUND;
                    250:
                    251:
                    252: +  /* ensure we have root */
                    253: +  if (stat==MATFOUND){
                    254: +   G1=gset_toric_ideal(M,Mm,Mn);
                    255: +  }
                    256:
                    257: +  fprintf(outfile,"[\n");
                    258: +  /* perform reverse search if desired*/
                    259: +  if (root_only==FALSE){
                    260: +    if (use_exsearch==FALSE){
                    261: +      /* should double check we are at root */
                    262: +      tt=clock();
                    263: +      counter=rsearch(G1);
                    264: +      tt=(clock()-tt)/CLOCKS_PER_SEC;
                    265: +      fprintf(outfile,"\n");
                    266: +    } else {
                    267: +      tt=clock();
                    268: +      counter=exsearch(G1);
                    269: +      tt=(clock()-tt)/CLOCKS_PER_SEC;
                    270: +      fprintf(outfile,"\n");
                    271: +    }
                    272: +  }
1.3     ! ohara     273:
1.1       maekawa   274: +  fprintf(outfile,"]\n");
                    275: +  LP_free_space();
                    276: +  if (G1!=0) gset_free(G1);
                    277: +}
1.3     ! ohara     278:
        !           279:
1.2       takayama  280: +main(int argc, char *argv[]) { infile=stdin; outfile=stdout;
1.1       maekawa   281: +  if (argc > 1) {
                    282: +    tiger_executeString_M(argv[1]);
                    283: +  }else{
                    284: +    tiger_executeString_M("2 4 : 1 1 1 1    0 1 2 3");
                    285: +  }
                    286: +}
                    287: diff -urN TiGERS_0.9.orig/gset.c TiGERS_0.9/gset.c
                    288: --- TiGERS_0.9.orig/gset.c     Sat Jan  8 07:42:43 2000
                    289: +++ TiGERS_0.9/gset.c  Sat Jan  8 07:43:41 2000
                    290: @@ -13,6 +13,7 @@
                    291:  #include "gset.h"
                    292:  #include "matrices.h"
                    293:  #include "Rsimp.h"
                    294: +extern int NT;
                    295:
                    296:  /* uncomment the following to cause use sainity checks (not fully tested)*/
                    297:  /*
                    298: @@ -81,12 +82,21 @@
                    299:  void gset_print(FILE *of,gset g){
                    300:    binomial b;
                    301:
                    302: -  fprintf(of,"{");
                    303: -  for(b=g->bottom;b!=0;b=b->next){
                    304: -    binomial_print(of,b);
                    305: -    if (b->next!=0) fprintf(of,", ");
                    306: +  if (NT == 1) {
                    307: +    fprintf(of,"[");
                    308: +    for(b=g->bottom;b!=0;b=b->next){
                    309: +      binomial_print(of,b);
                    310: +      if (b->next!=0) fprintf(of," , ");
                    311: +    }
                    312: +    fprintf(of,"]");
                    313: +  }else{
                    314: +    fprintf(of,"{");
                    315: +    for(b=g->bottom;b!=0;b=b->next){
                    316: +      binomial_print(of,b);
                    317: +      if (b->next!=0) fprintf(of,", ");
                    318: +    }
                    319: +    fprintf(of,"}");
                    320:    }
                    321: -  fprintf(of,"}");
                    322:  }
                    323:
                    324:  /*
                    325: diff -urN TiGERS_0.9.orig/memo.txt TiGERS_0.9/memo.txt
                    326: --- TiGERS_0.9.orig/memo.txt   Thu Jan  1 09:00:00 1970
                    327: +++ TiGERS_0.9/memo.txt        Sat Jan  8 07:43:41 2000
                    328: @@ -0,0 +1,33 @@
                    329: +Open XM $B2=$O#2$H$*$j$NJ}K!$,$"$j(B.  1999, 6/26
                    330: +$B0l$D$O(B, $B=PNO$r%Q!<%5$GM}2r$9$kJ}K!!#(B
                    331: +$B$b$&$R$H$D$O$Q$C$A$7$F$7$^$&J}K!(B.
                    332: +
                    333: +int NT = 1 ;
                    334: +
                    335: +yama2:S/Ti $B$,:n6H%G%#%l%/%H%j(B.
                    336: +
                    337: +print_monomial (binomial.c)  $B$r%j%9%H7A<0$KJQ99(B.
                    338: +$B:G=*E*$K$O(B fprintf $B$G$O$J$/(B, $B%j%9%H$r9=@.$7$FJV$9$h$&$KJQ99$G$-$k$H;W$&(B.
                    339: +$B$3$A$i$NJ}$,$$$$$+(B. $B$3$A$i$O(B NT = 2 $B$G$d$k$3$H$K$7$h$&(B.
                    340: +
                    341: +binomial_print
                    342: +
                    343: +gset_print   (gset.c)    Grobner basis $B$r%W%j%s%H$9$k(B.
                    344: +
                    345: +vertex_print  (tiger.c)  vertex $B$r%W%j%s%H$9$k(B.
                    346: +
                    347: +call.c $B$,(B top level.  main $B$b$"$k$h(B.
                    348: +
                    349: +imatrix_read $B$r(B, string $B$h$jFI$`$h$&$K$+$($F(B,
                    350: +$B<!$N%3%^%s%I$r<B9T$G$-$k$h$&$K$7$?!#(B
                    351: +main(int argc, char *argv[]) {
                    352: +  if (argc > 1) {
                    353: +    tiger_executeString_M(argv[1]);
                    354: +  }else{
                    355: +    tiger_executeString_M("2 4 : 1 1 1 1    0 1 2 3");
                    356: +  }
                    357: +}
                    358: +
                    359: +---  TiGER $B$N7P83$O(B, $B>.$5$$%=%U%H$r$$$+$K(B Open XM server $B2=$9$k$+$N(B
                    360: +---  $B$h$$7P83$K$J$k$H;W$&(B.  $B$3$N7P83$r%W%m%0%i%`:nK!$H$7$F5-O?$9$k$N$O(B
                    361: +---  $BBg;v$G$"$m$&(B. $B$N$3$j$OF|K\$G$d$k(B.  $B$"$H$O(B, $B5i?t2r$N9=@.%W%m%0%i%`(B.
                    362: diff -urN TiGERS_0.9.orig/tigers.c TiGERS_0.9/tigers.c
                    363: --- TiGERS_0.9.orig/tigers.c   Sat Jan  8 07:42:43 2000
                    364: +++ TiGERS_0.9/tigers.c        Sat Jan  8 07:43:41 2000
                    365: @@ -12,6 +12,7 @@
                    366:  #include "utils.h"
                    367:  #include "gset.h"
                    368:  int rsearch_cache=TRUE;
                    369: +extern int NT;
                    370:
                    371:  /*
                    372:  ** Output initial ideals and numbers of facets at each stage.
                    373: @@ -32,27 +33,31 @@
                    374:  #define max(a,b) (((a)>(b))?(a):(b))
                    375:  #define min(a,b) (((a)<(b))?(a):(b))
                    376:  void vertex_print(gset g1){
                    377: -  stats_maxfacets=max(gset_nfacets(g1),stats_maxfacets);
                    378: -  stats_maxelts=max(gset_nelts(g1),stats_maxelts);
                    379: -  stats_maxdeg=max(gset_deg(g1),stats_maxdeg);
                    380: -  if (stats_minfacets<0) stats_minfacets=gset_nfacets(g1);
                    381: -  else stats_minfacets=min(stats_minfacets,gset_nfacets(g1));
                    382: -  if (stats_minelts<0) stats_minelts=gset_nelts(g1);
                    383: -  else stats_minelts=min(stats_minelts,gset_nelts(g1));
                    384: -  if (stats_mindeg<0) stats_mindeg=gset_deg(g1);
                    385: -  else stats_mindeg=min(stats_mindeg,gset_deg(g1));
                    386: -  fprintf(outfile,"Vtx: %d (%d facets/%d binomials/degree %d)\n",
                    387: -         gset_id(g1),gset_nfacets(g1),gset_nelts(g1),gset_deg(g1));
                    388: -   if (print_init==TRUE){
                    389: -        fprintf(outfile,"    Initial ideal:");gset_init_print(outfile,g1);
                    390: -        fprintf(outfile,"\n  Facet Binomials:");gset_facet_print(outfile,g1);
                    391: -   }
                    392: -   else  gset_print(outfile,g1);
                    393: -   if (print_tree==TRUE && rsearch_cache==TRUE && gset_cache_vtx(g1)!=0){
                    394: +  if (NT == 1) {
                    395: +    gset_print(outfile,g1); fprintf(outfile," ,\n");
                    396: +  }else{
                    397: +    stats_maxfacets=max(gset_nfacets(g1),stats_maxfacets);
                    398: +    stats_maxelts=max(gset_nelts(g1),stats_maxelts);
                    399: +    stats_maxdeg=max(gset_deg(g1),stats_maxdeg);
                    400: +    if (stats_minfacets<0) stats_minfacets=gset_nfacets(g1);
                    401: +    else stats_minfacets=min(stats_minfacets,gset_nfacets(g1));
                    402: +    if (stats_minelts<0) stats_minelts=gset_nelts(g1);
                    403: +    else stats_minelts=min(stats_minelts,gset_nelts(g1));
                    404: +    if (stats_mindeg<0) stats_mindeg=gset_deg(g1);
                    405: +    else stats_mindeg=min(stats_mindeg,gset_deg(g1));
                    406: +    fprintf(outfile,"Vtx: %d (%d facets/%d binomials/degree %d)\n",
                    407: +          gset_id(g1),gset_nfacets(g1),gset_nelts(g1),gset_deg(g1));
                    408: +    if (print_init==TRUE){
                    409: +      fprintf(outfile,"    Initial ideal:");gset_init_print(outfile,g1);
                    410: +      fprintf(outfile,"\n  Facet Binomials:");gset_facet_print(outfile,g1);
                    411: +    }
                    412: +    else  gset_print(outfile,g1);
                    413: +    if (print_tree==TRUE && rsearch_cache==TRUE && gset_cache_vtx(g1)!=0){
                    414:        fprintf(outfile,"\n  Reducing Edge: [%d,%d]",
                    415:                gset_id(g1),gset_id(gset_cache_vtx(g1)));
                    416: -   }
                    417: -   fprintf(outfile,"\n");
                    418: +    }
                    419: +    fprintf(outfile,"\n");
                    420: +  }
                    421:  }
                    422:
                    423:
                    424: diff -urN TiGERS_0.9.orig/toric.c TiGERS_0.9/toric.c
                    425: --- TiGERS_0.9.orig/toric.c    Sat Jan  8 07:42:43 2000
                    426: +++ TiGERS_0.9/toric.c Sat Jan  8 07:43:41 2000
                    427: @@ -15,7 +15,7 @@
                    428:  #include "gset.h"
                    429:  #include "matrices.h"
                    430:  #include "Rsimp.h"
                    431: -
                    432: +extern int NT;
                    433:
                    434:
                    435:
                    436: @@ -34,7 +34,10 @@
                    437:    int lold,jk;
                    438:
                    439:    /* progress report */
                    440: -  fprintf(stderr,"taking colon of J with %c:\n",'a'+lv);
                    441: +  if (NT == 1) {
                    442: +  }else{
                    443: +    fprintf(stderr,"taking colon of J with %c:\n",'a'+lv);
                    444: +  }
                    445:
                    446:    /* set lex last variable to be lv */
                    447:    lold=ring_lv;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>