[BACK]Return to kanlib1.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Doc

Annotation of OpenXM/src/kan96xx/Doc/kanlib1.c, Revision 1.1.1.1

1.1       maekawa     1: /* 1996, 1/5
                      2:    kanlib1.c : an example of how to use kan from your C-program.
                      3: */
                      4:
                      5: #include <stdio.h>
                      6: #include "datatype.h"
                      7: #include "stackm.h"
                      8: #include "extern.h"
                      9: #include "extern2.h"
                     10: #include "lookup.h"
                     11: #include "matrix.h"
                     12: #include "gradedset.h"
                     13:
                     14: main() {
                     15:   struct object of;
                     16:   POLY f;
                     17:   extern int Quiet;
                     18:   Quiet = 1;
                     19:   KSstart();   /********  initialize ***********/
                     20:   /* Call setjmp(EnvOfStackMachine) for error handling. cf. scanner() in
                     21:    Kan/stackmachine.c */
                     22:
                     23:   /* First, define ring Q[x,y] and put ff = Expand[(x+y)^10]; */
                     24:   KSexecuteString("[(x,y) ring_of_polynomials ( ) elimination_order 0] define_ring");
                     25:   KSexecuteString("( (x+y)^10 ).  /ff set  ff print newline");
                     26:
                     27:   /* Put f = ff and compute f*f by calling ppMult() in kanlib.a. */
                     28:   printf("\n\n");
                     29:   KSexecuteString("ff"); of = KSpop();
                     30:   f = of.lc.poly;
                     31:   f = ppMult(f,f); /* Now, f = (x+y)^10 * (x+y)^10. */
                     32:   printf("(x+y)^20= %s\n",POLYToString(f,' ',0));
                     33:
                     34:
                     35:   KSstop(); /* closing */
                     36: }
                     37:
                     38:

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