1 | // $Id: testcs.cc,v 1.2 1997-09-12 07:19:35 Singular Exp $ |
---|
2 | |
---|
3 | #include <factory.h> |
---|
4 | #include <factor.h> |
---|
5 | |
---|
6 | // testing: Characteristic Sets |
---|
7 | void |
---|
8 | setVarNames ( char * vnames ) |
---|
9 | { |
---|
10 | int i, n = strlen( vnames ); |
---|
11 | Variable dummy; |
---|
12 | for ( i = 0; i < n; i++ ) |
---|
13 | dummy = Variable( i+1, vnames[i] ); |
---|
14 | } |
---|
15 | |
---|
16 | main() |
---|
17 | { |
---|
18 | int reord=0; // use strategy for reordering? |
---|
19 | int charac; |
---|
20 | cout << " Characteristic = "; cin >> charac; |
---|
21 | setCharacteristic(charac); |
---|
22 | On(SW_SYMMETRIC_FF); |
---|
23 | char vnames[30]; |
---|
24 | cout << " vnames = "; cin >> vnames; |
---|
25 | |
---|
26 | setVarNames( vnames ); |
---|
27 | |
---|
28 | CFList F1,F2; |
---|
29 | ListCFList Q; |
---|
30 | CanonicalForm f; |
---|
31 | CFListIterator I ; |
---|
32 | int i = 1; |
---|
33 | PremForm Remembern; |
---|
34 | Varlist betterorder; |
---|
35 | |
---|
36 | cout << " f[" << i << "] = "; cin >> f; |
---|
37 | while ( f != 0 ) { |
---|
38 | F1.append( f ); i++; |
---|
39 | cout << " f[" << i << "] = "; cin >> f; |
---|
40 | } |
---|
41 | F2=F1; |
---|
42 | cout << endl; |
---|
43 | |
---|
44 | cout << "F = " << F1 << endl; |
---|
45 | if (reord){ |
---|
46 | betterorder= neworder(F1); |
---|
47 | cout << "new orderd vars: " << betterorder << endl; |
---|
48 | F1=reorder(betterorder,F1); |
---|
49 | cout << "new F= " << F1 << endl; |
---|
50 | } |
---|
51 | // cout << "\nUsing Modified CharSet:" << endl; |
---|
52 | // F2 = MCharSetN( F1, Remembern ); |
---|
53 | // cout << "MCsN(F) = " << F2 << endl; |
---|
54 | // cout << "Factors removed: " << Remembern.FS2 << endl; |
---|
55 | // cout << "Possible Factors considered: " << Remembern.FS1 << endl; |
---|
56 | // for ( I = F2; I.hasItem(); I++ ) |
---|
57 | // cout << " vars: " << getVars( I.getItem() ) << endl; |
---|
58 | cout << "\nUsing IrrCharSeries:" << endl; |
---|
59 | Q= IrrCharSeries( F1 ); |
---|
60 | cout << "ics(F) = " << Q << endl; |
---|
61 | if (reord){ |
---|
62 | Q=reorder(betterorder,Q); |
---|
63 | cout << "reorderd ics(F) = " << Q << endl; |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|