Annotation of OpenXM/src/tigers/tigers.patch, Revision 1.4
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
! 3: +++ TiGERS_0.9/Makefile 2014-03-30 04:58:05.000000000 +0900
! 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
14: --- TiGERS_0.9.orig/NOTE.txt Thu Jan 1 09:00:00 1970
15: +++ TiGERS_0.9/NOTE.txt Sat Jan 8 07:43:41 2000
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
19: --- TiGERS_0.9.orig/README.change Thu Jan 1 09:00:00 1970
20: +++ TiGERS_0.9/README.change Sat Jan 8 07:46:11 2000
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
24: --- TiGERS_0.9.orig/binomial.c Sat Jan 8 07:42:43 2000
25: +++ TiGERS_0.9/binomial.c Sat Jan 8 07:43:41 2000
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.3 ohara 109: --- TiGERS_0.9.orig/call.c Sat Jun 12 07:05:52 1999
110: +++ TiGERS_0.9/call.c Wed Dec 15 03:06:28 2004
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
300: --- TiGERS_0.9.orig/gset.c Sat Jan 8 07:42:43 2000
301: +++ TiGERS_0.9/gset.c Sat Jan 8 07:43:41 2000
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: /*
337: diff -urN TiGERS_0.9.orig/memo.txt TiGERS_0.9/memo.txt
338: --- TiGERS_0.9.orig/memo.txt Thu Jan 1 09:00:00 1970
339: +++ TiGERS_0.9/memo.txt Sat Jan 8 07:43:41 2000
340: @@ -0,0 +1,33 @@
341: +Open XM $B2=$O#2$H$*$j$NJ}K!$,$"$j(B. 1999, 6/26
342: +$B0l$D$O(B, $B=PNO$r%Q!<%5$GM}2r$9$kJ}K!!#(B
343: +$B$b$&$R$H$D$O$Q$C$A$7$F$7$^$&J}K!(B.
344: +
345: +int NT = 1 ;
346: +
347: +yama2:S/Ti $B$,:n6H%G%#%l%/%H%j(B.
348: +
349: +print_monomial (binomial.c) $B$r%j%9%H7A<0$KJQ99(B.
350: +$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.
351: +$B$3$A$i$NJ}$,$$$$$+(B. $B$3$A$i$O(B NT = 2 $B$G$d$k$3$H$K$7$h$&(B.
352: +
353: +binomial_print
354: +
355: +gset_print (gset.c) Grobner basis $B$r%W%j%s%H$9$k(B.
356: +
357: +vertex_print (tiger.c) vertex $B$r%W%j%s%H$9$k(B.
358: +
359: +call.c $B$,(B top level. main $B$b$"$k$h(B.
360: +
361: +imatrix_read $B$r(B, string $B$h$jFI$`$h$&$K$+$($F(B,
362: +$B<!$N%3%^%s%I$r<B9T$G$-$k$h$&$K$7$?!#(B
363: +main(int argc, char *argv[]) {
364: + if (argc > 1) {
365: + tiger_executeString_M(argv[1]);
366: + }else{
367: + tiger_executeString_M("2 4 : 1 1 1 1 0 1 2 3");
368: + }
369: +}
370: +
371: +--- TiGER $B$N7P83$O(B, $B>.$5$$%=%U%H$r$$$+$K(B Open XM server $B2=$9$k$+$N(B
372: +--- $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
373: +--- $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.
374: diff -urN TiGERS_0.9.orig/tigers.c TiGERS_0.9/tigers.c
375: --- TiGERS_0.9.orig/tigers.c Sat Jan 8 07:42:43 2000
376: +++ TiGERS_0.9/tigers.c Sat Jan 8 07:43:41 2000
377: @@ -12,6 +12,7 @@
378: #include "utils.h"
379: #include "gset.h"
380: int rsearch_cache=TRUE;
381: +extern int NT;
382:
383: /*
384: ** Output initial ideals and numbers of facets at each stage.
385: @@ -32,27 +33,31 @@
386: #define max(a,b) (((a)>(b))?(a):(b))
387: #define min(a,b) (((a)<(b))?(a):(b))
388: void vertex_print(gset g1){
389: - stats_maxfacets=max(gset_nfacets(g1),stats_maxfacets);
390: - stats_maxelts=max(gset_nelts(g1),stats_maxelts);
391: - stats_maxdeg=max(gset_deg(g1),stats_maxdeg);
392: - if (stats_minfacets<0) stats_minfacets=gset_nfacets(g1);
393: - else stats_minfacets=min(stats_minfacets,gset_nfacets(g1));
394: - if (stats_minelts<0) stats_minelts=gset_nelts(g1);
395: - else stats_minelts=min(stats_minelts,gset_nelts(g1));
396: - if (stats_mindeg<0) stats_mindeg=gset_deg(g1);
397: - else stats_mindeg=min(stats_mindeg,gset_deg(g1));
398: - fprintf(outfile,"Vtx: %d (%d facets/%d binomials/degree %d)\n",
399: - gset_id(g1),gset_nfacets(g1),gset_nelts(g1),gset_deg(g1));
400: - if (print_init==TRUE){
401: - fprintf(outfile," Initial ideal:");gset_init_print(outfile,g1);
402: - fprintf(outfile,"\n Facet Binomials:");gset_facet_print(outfile,g1);
403: - }
404: - else gset_print(outfile,g1);
405: - if (print_tree==TRUE && rsearch_cache==TRUE && gset_cache_vtx(g1)!=0){
406: + if (NT == 1) {
407: + gset_print(outfile,g1); fprintf(outfile," ,\n");
408: + }else{
409: + stats_maxfacets=max(gset_nfacets(g1),stats_maxfacets);
410: + stats_maxelts=max(gset_nelts(g1),stats_maxelts);
411: + stats_maxdeg=max(gset_deg(g1),stats_maxdeg);
412: + if (stats_minfacets<0) stats_minfacets=gset_nfacets(g1);
413: + else stats_minfacets=min(stats_minfacets,gset_nfacets(g1));
414: + if (stats_minelts<0) stats_minelts=gset_nelts(g1);
415: + else stats_minelts=min(stats_minelts,gset_nelts(g1));
416: + if (stats_mindeg<0) stats_mindeg=gset_deg(g1);
417: + else stats_mindeg=min(stats_mindeg,gset_deg(g1));
418: + fprintf(outfile,"Vtx: %d (%d facets/%d binomials/degree %d)\n",
419: + gset_id(g1),gset_nfacets(g1),gset_nelts(g1),gset_deg(g1));
420: + if (print_init==TRUE){
421: + fprintf(outfile," Initial ideal:");gset_init_print(outfile,g1);
422: + fprintf(outfile,"\n Facet Binomials:");gset_facet_print(outfile,g1);
423: + }
424: + else gset_print(outfile,g1);
425: + if (print_tree==TRUE && rsearch_cache==TRUE && gset_cache_vtx(g1)!=0){
426: fprintf(outfile,"\n Reducing Edge: [%d,%d]",
427: gset_id(g1),gset_id(gset_cache_vtx(g1)));
428: - }
429: - fprintf(outfile,"\n");
430: + }
431: + fprintf(outfile,"\n");
432: + }
433: }
434:
435:
436: diff -urN TiGERS_0.9.orig/toric.c TiGERS_0.9/toric.c
437: --- TiGERS_0.9.orig/toric.c Sat Jan 8 07:42:43 2000
438: +++ TiGERS_0.9/toric.c Sat Jan 8 07:43:41 2000
439: @@ -15,7 +15,7 @@
440: #include "gset.h"
441: #include "matrices.h"
442: #include "Rsimp.h"
443: -
444: +extern int NT;
445:
446:
447:
448: @@ -34,7 +34,10 @@
449: int lold,jk;
450:
451: /* progress report */
452: - fprintf(stderr,"taking colon of J with %c:\n",'a'+lv);
453: + if (NT == 1) {
454: + }else{
455: + fprintf(stderr,"taking colon of J with %c:\n",'a'+lv);
456: + }
457:
458: /* set lex last variable to be lv */
459: lold=ring_lv;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>