[1a80b4] | 1 | //static char rcsid[] = "$Id: test.cc,v 1.1.1.1 1997-05-02 17:00:43 Singular Exp $"; |
---|
| 2 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 3 | // FACTORY - Includes |
---|
| 4 | // (x+y+z)*(x+y-z)*(x-y+z)*(x-y-z)*x*y; |
---|
| 5 | #include <factory.h> |
---|
| 6 | // Factor - Includes |
---|
| 7 | #include "factor.h" |
---|
| 8 | #include "tmpl_inst.h" |
---|
| 9 | #include "helpstuff.h" |
---|
| 10 | |
---|
| 11 | extern char * libfac_name; |
---|
| 12 | extern char * libfac_version; |
---|
| 13 | extern char * libfac_date; |
---|
| 14 | extern char * libfac_author; |
---|
| 15 | |
---|
| 16 | void |
---|
| 17 | setVarNames ( char * vnames ) |
---|
| 18 | { |
---|
| 19 | int i, n = strlen( vnames ); |
---|
| 20 | Variable dummy; |
---|
| 21 | for ( i = 0; i < n; i++ ) |
---|
| 22 | dummy = Variable( i+1, vnames[i] ); |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | main() |
---|
| 26 | { |
---|
| 27 | CanonicalForm f,g; |
---|
| 28 | int charac; |
---|
| 29 | CFFList Factorlist; |
---|
| 30 | CFFactor copy; |
---|
| 31 | |
---|
| 32 | cout << libfac_name <<", Version " << libfac_version << endl; |
---|
| 33 | // cout << " Characteristic = "; |
---|
| 34 | cin >> charac; |
---|
| 35 | setCharacteristic(charac); |
---|
| 36 | On(SW_SYMMETRIC_FF); |
---|
| 37 | On(SW_USE_EZGCD); |
---|
| 38 | ////////////////////////////////////////////////////////////// |
---|
| 39 | // char vnames[30]; |
---|
| 40 | //// cout << " vnames = "; |
---|
| 41 | // cin >> vnames; |
---|
| 42 | // |
---|
| 43 | // setVarNames( vnames ); |
---|
| 44 | // |
---|
| 45 | ////////////////////////////////////////////////////////////// |
---|
| 46 | // cout << " f = "; |
---|
| 47 | cin >> f; |
---|
| 48 | cout << f << " mod " << charac << " = " ; |
---|
| 49 | Factorlist= Factorize( f,0 ); |
---|
| 50 | cout << Factorlist ;//<< endl; |
---|
| 51 | // Ueberpruefen: |
---|
| 52 | g=1; |
---|
| 53 | for ( CFFListIterator i=Factorlist ; i.hasItem(); i++){ |
---|
| 54 | copy = i.getItem(); |
---|
| 55 | if ( getNumVars(copy.factor()) > 0 ) |
---|
| 56 | for ( int j=1; j<=copy.exp(); j++) |
---|
| 57 | g *= copy.factor(); |
---|
| 58 | else g *= copy.factor(); |
---|
| 59 | } |
---|
| 60 | if ( (f-g) != f.genZero() ){ |
---|
| 61 | cerr << "\nList and f differ: f= " << f << " g= " << g << endl; |
---|
| 62 | } |
---|
| 63 | } |
---|