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

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

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
        !            97: --- TiGERS_0.9.orig/call.c     Sat Jan  8 07:42:43 2000
        !            98: +++ TiGERS_0.9/call.c  Sat Jan  8 07:43:41 2000
        !            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:  */
        !           108: @@ -87,7 +89,7 @@
        !           109:
        !           110:  #define MATFOUND 1
        !           111:  #define GSETFOUND 2
        !           112: -main(int argc, char **argv ){
        !           113: +main2(int argc, char **argv ){
        !           114:   char *c,cc, *prog=argv[0], *ifname=0, *ofname=0;
        !           115:   int tmp,acnt,stat=0,counter;
        !           116:   gset G1=0,gset_toric_ideal();
        !           117: @@ -205,6 +207,29 @@
        !           118:     }
        !           119:    }
        !           120:
        !           121: +  if (NT == 1) {
        !           122: +
        !           123: +    fprintf(outfile,"[\n");
        !           124: +    /* perform reverse search if desired*/
        !           125: +    if (root_only==FALSE){
        !           126: +      if (use_exsearch==FALSE){
        !           127: +      /* should double check we are at root */
        !           128: +      tt=clock();
        !           129: +      counter=rsearch(G1);
        !           130: +      tt=(clock()-tt)/CLOCKS_PER_SEC;
        !           131: +      fprintf(outfile,"\n");
        !           132: +      } else {
        !           133: +      tt=clock();
        !           134: +      counter=exsearch(G1);
        !           135: +      tt=(clock()-tt)/CLOCKS_PER_SEC;
        !           136: +      fprintf(outfile,"\n");
        !           137: +      }
        !           138: +    }
        !           139: +
        !           140: +    fprintf(outfile,"]\n");
        !           141: +    goto epilogue ;
        !           142: +  }
        !           143: +  /* if NT != 1, then start the followings. */
        !           144:    /* output first GB if desired */
        !           145:    fprintf(outfile,"%% starting GB:\n");
        !           146:    fprintf(outfile,"R: %d\n",ring_N);
        !           147: @@ -314,15 +339,119 @@
        !           148:      return 0;
        !           149:      }
        !           150:    }
        !           151: +
        !           152: + epilogue: ;
        !           153:    /* clean up */
        !           154:    LP_free_space();
        !           155:    if (G1!=0) gset_free(G1);
        !           156:  }
        !           157:
        !           158:
        !           159: +/************************    NT ***************************/
        !           160: +static int findNextToken(char *is, int start)
        !           161: +{
        !           162: +  if (start == -1) goto endtext ;
        !           163: +  while ( is[start] <= ' ') {
        !           164: +    if (is[start] == '\0' ) goto endtext ;
        !           165: +    start++;
        !           166: +  }
        !           167: +  while ( is[start] > ' ') {
        !           168: +    if (is[start] == '\0') goto endtext ;
        !           169: +    start++;
        !           170: +  }
        !           171: +  while ( is[start] <= ' ') {
        !           172: +    if (is[start] == '\0' ) goto endtext ;
        !           173: +    start++;
        !           174: +  }
        !           175: +  return(start);
        !           176: + endtext: ;
        !           177: +  fprintf(stderr,"findNextToken: end of the text.\n");
        !           178: +  return(-1);
        !           179: +}
        !           180: +int **imatrix_read_from_string(char *is,int *m, int *n) {
        !           181: +  char c;
        !           182: +  int i,j;
        !           183: +  int **M;
        !           184: +  int pt = 0;
        !           185: +
        !           186: +  /*  2 3 :
        !           187: +      1 1 1
        !           188: +      0 1 2
        !           189: +  */
        !           190: +  /* read in matrix dimensions and initialize matrix */
        !           191: +  sscanf(is,"%d %d :",m,n);
        !           192: +  M=new_imatrix(*m,*n);
        !           193: +  pt = findNextToken(is,pt); /* n */
        !           194: +  pt = findNextToken(is,pt); /* : */
        !           195: +
        !           196: +  /* read in matrix entrees */
        !           197: +  for(i=0;i<*m;i++){
        !           198: +    for(j=0;j<*n;j++){
        !           199: +      pt = findNextToken(is,pt);
        !           200: +      sscanf(&(is[pt]),"%d",&(IMref(M,i,j)));
        !           201: +    }
        !           202: +  }
        !           203: +
        !           204: +  return M;
        !           205: +}
        !           206:
        !           207: +tiger_executeString_M(char *is) {
        !           208: +  char *c,cc, *prog="tigers", *ifname=0, *ofname=0;
        !           209: +  int tmp,acnt,stat=0,counter;
        !           210: +  gset G1=0,gset_toric_ideal();
        !           211: +  int **M=0,Mn,Mm;
        !           212: +  double tt;
        !           213:
        !           214: +  /* initialize parameters */
        !           215: +  root_only=FALSE;
        !           216: +  rsearch_cache=TRUE;
        !           217: +  print_tree=FALSE;
        !           218: +  print_init=FALSE;
        !           219:
        !           220: +  if ((M=imatrix_read_from_string(is,&Mm,&Mn))==0){
        !           221: +     fprintf(stderr,"%s: imatrix_read() failed\n",prog);
        !           222: +     exit(1);
        !           223: +  }
        !           224: +  if (ring_N==0) ring_set(Mn);
        !           225: +  else if (ring_N!=Mn) {
        !           226: +    fprintf(stderr,"%s: Matrix collum and ring dimensions must agree\n",prog);
        !           227: +    exit(1);
        !           228: +  }
        !           229: +  stat=MATFOUND;
        !           230:
        !           231:
        !           232: +  /* ensure we have root */
        !           233: +  if (stat==MATFOUND){
        !           234: +   G1=gset_toric_ideal(M,Mm,Mn);
        !           235: +  }
        !           236:
        !           237: +  fprintf(outfile,"[\n");
        !           238: +  /* perform reverse search if desired*/
        !           239: +  if (root_only==FALSE){
        !           240: +    if (use_exsearch==FALSE){
        !           241: +      /* should double check we are at root */
        !           242: +      tt=clock();
        !           243: +      counter=rsearch(G1);
        !           244: +      tt=(clock()-tt)/CLOCKS_PER_SEC;
        !           245: +      fprintf(outfile,"\n");
        !           246: +    } else {
        !           247: +      tt=clock();
        !           248: +      counter=exsearch(G1);
        !           249: +      tt=(clock()-tt)/CLOCKS_PER_SEC;
        !           250: +      fprintf(outfile,"\n");
        !           251: +    }
        !           252: +  }
        !           253: +
        !           254: +  fprintf(outfile,"]\n");
        !           255: +  LP_free_space();
        !           256: +  if (G1!=0) gset_free(G1);
        !           257: +}
        !           258: +
        !           259: +
        !           260: +main(int argc, char *argv[]) {
        !           261: +  if (argc > 1) {
        !           262: +    tiger_executeString_M(argv[1]);
        !           263: +  }else{
        !           264: +    tiger_executeString_M("2 4 : 1 1 1 1    0 1 2 3");
        !           265: +  }
        !           266: +}
        !           267: diff -urN TiGERS_0.9.orig/gset.c TiGERS_0.9/gset.c
        !           268: --- TiGERS_0.9.orig/gset.c     Sat Jan  8 07:42:43 2000
        !           269: +++ TiGERS_0.9/gset.c  Sat Jan  8 07:43:41 2000
        !           270: @@ -13,6 +13,7 @@
        !           271:  #include "gset.h"
        !           272:  #include "matrices.h"
        !           273:  #include "Rsimp.h"
        !           274: +extern int NT;
        !           275:
        !           276:  /* uncomment the following to cause use sainity checks (not fully tested)*/
        !           277:  /*
        !           278: @@ -81,12 +82,21 @@
        !           279:  void gset_print(FILE *of,gset g){
        !           280:    binomial b;
        !           281:
        !           282: -  fprintf(of,"{");
        !           283: -  for(b=g->bottom;b!=0;b=b->next){
        !           284: -    binomial_print(of,b);
        !           285: -    if (b->next!=0) fprintf(of,", ");
        !           286: +  if (NT == 1) {
        !           287: +    fprintf(of,"[");
        !           288: +    for(b=g->bottom;b!=0;b=b->next){
        !           289: +      binomial_print(of,b);
        !           290: +      if (b->next!=0) fprintf(of," , ");
        !           291: +    }
        !           292: +    fprintf(of,"]");
        !           293: +  }else{
        !           294: +    fprintf(of,"{");
        !           295: +    for(b=g->bottom;b!=0;b=b->next){
        !           296: +      binomial_print(of,b);
        !           297: +      if (b->next!=0) fprintf(of,", ");
        !           298: +    }
        !           299: +    fprintf(of,"}");
        !           300:    }
        !           301: -  fprintf(of,"}");
        !           302:  }
        !           303:
        !           304:  /*
        !           305: diff -urN TiGERS_0.9.orig/memo.txt TiGERS_0.9/memo.txt
        !           306: --- TiGERS_0.9.orig/memo.txt   Thu Jan  1 09:00:00 1970
        !           307: +++ TiGERS_0.9/memo.txt        Sat Jan  8 07:43:41 2000
        !           308: @@ -0,0 +1,33 @@
        !           309: +Open XM $B2=$O#2$H$*$j$NJ}K!$,$"$j(B.  1999, 6/26
        !           310: +$B0l$D$O(B, $B=PNO$r%Q!<%5$GM}2r$9$kJ}K!!#(B
        !           311: +$B$b$&$R$H$D$O$Q$C$A$7$F$7$^$&J}K!(B.
        !           312: +
        !           313: +int NT = 1 ;
        !           314: +
        !           315: +yama2:S/Ti $B$,:n6H%G%#%l%/%H%j(B.
        !           316: +
        !           317: +print_monomial (binomial.c)  $B$r%j%9%H7A<0$KJQ99(B.
        !           318: +$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.
        !           319: +$B$3$A$i$NJ}$,$$$$$+(B. $B$3$A$i$O(B NT = 2 $B$G$d$k$3$H$K$7$h$&(B.
        !           320: +
        !           321: +binomial_print
        !           322: +
        !           323: +gset_print   (gset.c)    Grobner basis $B$r%W%j%s%H$9$k(B.
        !           324: +
        !           325: +vertex_print  (tiger.c)  vertex $B$r%W%j%s%H$9$k(B.
        !           326: +
        !           327: +call.c $B$,(B top level.  main $B$b$"$k$h(B.
        !           328: +
        !           329: +imatrix_read $B$r(B, string $B$h$jFI$`$h$&$K$+$($F(B,
        !           330: +$B<!$N%3%^%s%I$r<B9T$G$-$k$h$&$K$7$?!#(B
        !           331: +main(int argc, char *argv[]) {
        !           332: +  if (argc > 1) {
        !           333: +    tiger_executeString_M(argv[1]);
        !           334: +  }else{
        !           335: +    tiger_executeString_M("2 4 : 1 1 1 1    0 1 2 3");
        !           336: +  }
        !           337: +}
        !           338: +
        !           339: +---  TiGER $B$N7P83$O(B, $B>.$5$$%=%U%H$r$$$+$K(B Open XM server $B2=$9$k$+$N(B
        !           340: +---  $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
        !           341: +---  $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.
        !           342: diff -urN TiGERS_0.9.orig/tigers.c TiGERS_0.9/tigers.c
        !           343: --- TiGERS_0.9.orig/tigers.c   Sat Jan  8 07:42:43 2000
        !           344: +++ TiGERS_0.9/tigers.c        Sat Jan  8 07:43:41 2000
        !           345: @@ -12,6 +12,7 @@
        !           346:  #include "utils.h"
        !           347:  #include "gset.h"
        !           348:  int rsearch_cache=TRUE;
        !           349: +extern int NT;
        !           350:
        !           351:  /*
        !           352:  ** Output initial ideals and numbers of facets at each stage.
        !           353: @@ -32,27 +33,31 @@
        !           354:  #define max(a,b) (((a)>(b))?(a):(b))
        !           355:  #define min(a,b) (((a)<(b))?(a):(b))
        !           356:  void vertex_print(gset g1){
        !           357: -  stats_maxfacets=max(gset_nfacets(g1),stats_maxfacets);
        !           358: -  stats_maxelts=max(gset_nelts(g1),stats_maxelts);
        !           359: -  stats_maxdeg=max(gset_deg(g1),stats_maxdeg);
        !           360: -  if (stats_minfacets<0) stats_minfacets=gset_nfacets(g1);
        !           361: -  else stats_minfacets=min(stats_minfacets,gset_nfacets(g1));
        !           362: -  if (stats_minelts<0) stats_minelts=gset_nelts(g1);
        !           363: -  else stats_minelts=min(stats_minelts,gset_nelts(g1));
        !           364: -  if (stats_mindeg<0) stats_mindeg=gset_deg(g1);
        !           365: -  else stats_mindeg=min(stats_mindeg,gset_deg(g1));
        !           366: -  fprintf(outfile,"Vtx: %d (%d facets/%d binomials/degree %d)\n",
        !           367: -         gset_id(g1),gset_nfacets(g1),gset_nelts(g1),gset_deg(g1));
        !           368: -   if (print_init==TRUE){
        !           369: -        fprintf(outfile,"    Initial ideal:");gset_init_print(outfile,g1);
        !           370: -        fprintf(outfile,"\n  Facet Binomials:");gset_facet_print(outfile,g1);
        !           371: -   }
        !           372: -   else  gset_print(outfile,g1);
        !           373: -   if (print_tree==TRUE && rsearch_cache==TRUE && gset_cache_vtx(g1)!=0){
        !           374: +  if (NT == 1) {
        !           375: +    gset_print(outfile,g1); fprintf(outfile," ,\n");
        !           376: +  }else{
        !           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:        fprintf(outfile,"\n  Reducing Edge: [%d,%d]",
        !           395:                gset_id(g1),gset_id(gset_cache_vtx(g1)));
        !           396: -   }
        !           397: -   fprintf(outfile,"\n");
        !           398: +    }
        !           399: +    fprintf(outfile,"\n");
        !           400: +  }
        !           401:  }
        !           402:
        !           403:
        !           404: diff -urN TiGERS_0.9.orig/toric.c TiGERS_0.9/toric.c
        !           405: --- TiGERS_0.9.orig/toric.c    Sat Jan  8 07:42:43 2000
        !           406: +++ TiGERS_0.9/toric.c Sat Jan  8 07:43:41 2000
        !           407: @@ -15,7 +15,7 @@
        !           408:  #include "gset.h"
        !           409:  #include "matrices.h"
        !           410:  #include "Rsimp.h"
        !           411: -
        !           412: +extern int NT;
        !           413:
        !           414:
        !           415:
        !           416: @@ -34,7 +34,10 @@
        !           417:    int lold,jk;
        !           418:
        !           419:    /* progress report */
        !           420: -  fprintf(stderr,"taking colon of J with %c:\n",'a'+lv);
        !           421: +  if (NT == 1) {
        !           422: +  }else{
        !           423: +    fprintf(stderr,"taking colon of J with %c:\n",'a'+lv);
        !           424: +  }
        !           425:
        !           426:    /* set lex last variable to be lv */
        !           427:    lold=ring_lv;

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