fieker-DuValspielwiese
Last change
on this file since 6909cfb was
00d2a4,
checked in by Oleksandr Motsak <motsak@…>, 11 years ago
|
Fixed the usage pattern for StringEndS
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | // Example program how to use libsingular |
---|
2 | |
---|
3 | #include <Singular/libsingular.h> |
---|
4 | #include <unistd.h> |
---|
5 | |
---|
6 | #ifdef HAVE_FACTORY |
---|
7 | int mmInit(void) {return 1; } // ? due to SINGULAR!!!...??? |
---|
8 | #endif |
---|
9 | |
---|
10 | |
---|
11 | int 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 | |
---|
18 | { StringAppendS("\n"); char* s = StringEndS(); PrintS(s); omFree(s); } |
---|
19 | |
---|
20 | // // init path names etc. |
---|
21 | // siInit(argv[0]); |
---|
22 | |
---|
23 | |
---|
24 | // construct the ring Z/32003[x,y,z] |
---|
25 | // the variable names |
---|
26 | char **n=(char**)omalloc(3*sizeof(char*)); |
---|
27 | n[0]=omStrDup("x"); |
---|
28 | n[1]=omStrDup("y"); |
---|
29 | n[2]=omStrDup("z2"); |
---|
30 | |
---|
31 | ring R=rDefault(32003,3,n); |
---|
32 | // make R the default ring: |
---|
33 | rChangeCurrRing(R); |
---|
34 | |
---|
35 | // create the polynomial 1 |
---|
36 | poly p1=p_ISet(1,R); |
---|
37 | |
---|
38 | // create tthe polynomial 2*x^3*z^2 |
---|
39 | poly p2=p_ISet(2,R); |
---|
40 | pSetExp(p2,1,3); |
---|
41 | pSetExp(p2,3,2); |
---|
42 | pSetm(p2); |
---|
43 | |
---|
44 | // print p1 + p2 |
---|
45 | pWrite(p1); printf(" + \n"); pWrite(p2); printf("\n"); |
---|
46 | |
---|
47 | // compute p1+p2 |
---|
48 | p1=p_Add_q(p1,p2,R); p2=NULL; |
---|
49 | pWrite(p1); |
---|
50 | |
---|
51 | // sleep(120); |
---|
52 | |
---|
53 | // cleanup: |
---|
54 | pDelete(&p1); |
---|
55 | rKill(R); |
---|
56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.