source: git/factory/libfac/testcs.cc @ 16055bd

jengelh-datetimespielwiese
Last change on this file since 16055bd was 16055bd, checked in by Martin Lee <martinlee84@…>, 11 years ago
chg: move libfac into factory
  • Property mode set to 100644
File size: 1.7 KB
Line 
1
2#include <factory.h>
3#include <libfac.h>
4#ifdef HAVE_IOSTREAM
5#include <iostream>
6#define COUT std::cout
7#define CIN std::cin
8#elif defined(HAVE_IOSTREAM_H)
9#include <iostream.h>
10#define COUT cout
11#define CIN cin
12#endif
13
14
15// testing: Characteristic Sets
16void
17setVarNames ( 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
25main()
26{
27  int reord=0; // use strategy for reordering?
28  int charac;
29  COUT << " Characteristic = "; CIN >> charac;
30  setCharacteristic(charac);
31  On(SW_SYMMETRIC_FF);
32  char vnames[30];
33  COUT << " vnames = "; CIN >> vnames;
34
35  setVarNames( vnames );
36
37  CFList F1,F2;
38  ListCFList Q;
39  CanonicalForm f;
40  CFListIterator I ;
41  int i = 1;
42  PremForm Remembern;
43  Varlist betterorder;
44
45  COUT << " f[" << i << "] = "; cin >> f;
46  while ( f != 0 ) {
47    F1.append( f ); i++;
48    COUT << " f[" << i << "] = "; cin >> f;
49  }
50  F2=F1;
51  COUT << "\n";
52
53  COUT << "F = " << F1 << "\n";
54  if (reord){
55    betterorder= neworder(F1);
56    COUT << "new orderd vars: " << betterorder << "\n";
57    F1=reorder(betterorder,F1);
58    COUT << "new F= " << F1 << "\n";
59  }
60//   COUT << "\nUsing Modified CharSet:" << "\n";
61//   F2 = MCharSetN( F1, Remembern );
62//   COUT << "MCsN(F) = " << F2 << "\n";
63//   COUT << "Factors removed: " << Remembern.FS2 << "\n";
64//   COUT << "Possible Factors considered: " << Remembern.FS1 << "\n";
65//   for ( I = F2; I.hasItem(); I++ )
66//     COUT << "  vars: " << getVars( I.getItem() ) << "\n";
67  COUT << "\nUsing IrrCharSeries:" << "\n";
68  Q= IrrCharSeries( F1 );
69  COUT << "ics(F) = " << Q << "\n";
70  if (reord){
71    Q=reorder(betterorder,Q);
72    COUT << "reorderd ics(F) = " << Q << "\n";
73  }
74}
75
Note: See TracBrowser for help on using the repository browser.