source: git/standalone.test/tt.cc @ 98d6c3

fieker-DuValspielwiese
Last change on this file since 98d6c3 was 444bcf, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
CHG: minor cleanup ADD: original Hans's test for standalone testing: tt.cc FIX: typo
  • Property mode set to 100644
File size: 1.0 KB
Line 
1// Example program how to use libsingular
2
3#include <Singular/libsingular.h>
4#include <unistd.h>
5
6#ifdef HAVE_FACTORY
7int mmInit(void) {return 1; } // ? due to SINGULAR!!!...???
8#endif
9
10
11int main( int, char *argv[] ) 
12{
13  feInitResources(argv[0]);
14
15  StringSetS("ressources in use (as reported by feStringAppendResources(0):\n");
16  feStringAppendResources(0);
17  PrintS(StringAppendS("\n"));
18
19//  // init path names etc.
20//  siInit(argv[0]);
21
22
23  // construct the ring Z/32003[x,y,z]
24  // the variable names
25  char **n=(char**)omalloc(3*sizeof(char*));
26  n[0]=omStrDup("x");
27  n[1]=omStrDup("y");
28  n[2]=omStrDup("z2");
29
30  ring R=rDefault(32003,3,n);
31  // make R the default ring:
32  rChangeCurrRing(R);
33
34  // create the polynomial 1
35  poly p1=p_ISet(1,R);
36
37  // create tthe polynomial 2*x^3*z^2
38  poly p2=p_ISet(2,R);
39  pSetExp(p2,1,3);
40  pSetExp(p2,3,2);
41  pSetm(p2);
42
43  // print p1 + p2
44  pWrite(p1); printf(" + \n"); pWrite(p2); printf("\n");
45
46  // compute p1+p2
47  p1=p_Add_q(p1,p2,R); p2=NULL;
48  pWrite(p1); 
49
50//   sleep(120);
51
52  // cleanup:
53  pDelete(&p1);
54  rKill(R);
55}
Note: See TracBrowser for help on using the repository browser.