source: git/factory/libfac/testcs.cc @ 4e654a2

spielwiese
Last change on this file since 4e654a2 was e65b1a4, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
fix libfac on case-insensitive file systems CHG: renamed factory/libfac/factor.h into factory/libfac/libfac.h in order to avoid confusion with factory/libfac/factor/Factor.h on case-insensitive file systems...
  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[341696]1// $Id$
[0479e09]2
3#include <factory.h>
[e65b1a4]4#include <libfac.h>
[e2ca88]5#ifdef HAVE_IOSTREAM
6#include <iostream>
7#define COUT std::cout
8#define CIN std::cin
9#elif defined(HAVE_IOSTREAM_H)
10#include <iostream.h>
11#define COUT cout
12#define CIN cin
13#endif
14
[0479e09]15
16// testing: Characteristic Sets
17void
18setVarNames ( char * vnames )
19{
20    int i, n = strlen( vnames );
21    Variable dummy;
22    for ( i = 0; i < n; i++ )
23        dummy = Variable( i+1, vnames[i] );
24}
25
26main()
27{
28  int reord=0; // use strategy for reordering?
29  int charac;
[e2ca88]30  COUT << " Characteristic = "; CIN >> charac;
[0479e09]31  setCharacteristic(charac);
32  On(SW_SYMMETRIC_FF);
33  char vnames[30];
[e2ca88]34  COUT << " vnames = "; CIN >> vnames;
[0479e09]35
36  setVarNames( vnames );
37
38  CFList F1,F2;
39  ListCFList Q;
40  CanonicalForm f;
41  CFListIterator I ;
42  int i = 1;
43  PremForm Remembern;
44  Varlist betterorder;
45
[e2ca88]46  COUT << " f[" << i << "] = "; cin >> f;
[0479e09]47  while ( f != 0 ) {
48    F1.append( f ); i++;
[e2ca88]49    COUT << " f[" << i << "] = "; cin >> f;
[0479e09]50  }
51  F2=F1;
[e2ca88]52  COUT << "\n";
[0479e09]53
[e2ca88]54  COUT << "F = " << F1 << "\n";
[0479e09]55  if (reord){
56    betterorder= neworder(F1);
[e2ca88]57    COUT << "new orderd vars: " << betterorder << "\n";
[0479e09]58    F1=reorder(betterorder,F1);
[e2ca88]59    COUT << "new F= " << F1 << "\n";
[0479e09]60  }
[e2ca88]61//   COUT << "\nUsing Modified CharSet:" << "\n";
[0479e09]62//   F2 = MCharSetN( F1, Remembern );
[e2ca88]63//   COUT << "MCsN(F) = " << F2 << "\n";
64//   COUT << "Factors removed: " << Remembern.FS2 << "\n";
65//   COUT << "Possible Factors considered: " << Remembern.FS1 << "\n";
[0479e09]66//   for ( I = F2; I.hasItem(); I++ )
[e2ca88]67//     COUT << "  vars: " << getVars( I.getItem() ) << "\n";
68  COUT << "\nUsing IrrCharSeries:" << "\n";
[0479e09]69  Q= IrrCharSeries( F1 );
[e2ca88]70  COUT << "ics(F) = " << Q << "\n";
[0479e09]71  if (reord){
72    Q=reorder(betterorder,Q);
[e2ca88]73    COUT << "reorderd ics(F) = " << Q << "\n";
[0479e09]74  }
75}
76
Note: See TracBrowser for help on using the repository browser.