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