1 | // emacs edit mode for this file is -*- C++ -*- |
---|
2 | // $Id: cf_map.h,v 1.1 1996-07-08 08:17:22 stobbe Exp $ |
---|
3 | |
---|
4 | #ifndef INCL_CF_MAP_H |
---|
5 | #define INCL_CF_MAP_H |
---|
6 | |
---|
7 | /* |
---|
8 | $Log: not supported by cvs2svn $ |
---|
9 | Revision 1.0 1996/05/17 10:59:38 stobbe |
---|
10 | Initial revision |
---|
11 | |
---|
12 | */ |
---|
13 | |
---|
14 | #include <iostream.h> |
---|
15 | #include "variable.h" |
---|
16 | #include "templates/list.h" |
---|
17 | #include "canonicalform.h" |
---|
18 | |
---|
19 | /*BEGINPUBLIC*/ |
---|
20 | |
---|
21 | class MapPair |
---|
22 | { |
---|
23 | private: |
---|
24 | Variable V; |
---|
25 | CanonicalForm S; |
---|
26 | public: |
---|
27 | MapPair( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {} |
---|
28 | MapPair() : V(), S(1) {} |
---|
29 | MapPair( const MapPair & p ) : V(p.V), S(p.S) {} |
---|
30 | ~MapPair() {} |
---|
31 | MapPair& operator=( const MapPair & p ); |
---|
32 | Variable var() const { return V; } |
---|
33 | CanonicalForm subst() const { return S; } |
---|
34 | friend ostream& operator << ( ostream& s, const MapPair & p ); |
---|
35 | }; |
---|
36 | |
---|
37 | typedef List<MapPair> MPList; |
---|
38 | typedef ListIterator<MapPair> MPListIterator; |
---|
39 | |
---|
40 | |
---|
41 | class CFMap |
---|
42 | { |
---|
43 | private: |
---|
44 | MPList P; |
---|
45 | public: |
---|
46 | CFMap() {} |
---|
47 | CFMap( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {} |
---|
48 | CFMap( const Variable & v ) : P( MapPair( v, 1 ) ) {} |
---|
49 | CFMap( const Variable & v, const CanonicalForm & s ) : P( MapPair(v,s) ) {} |
---|
50 | ~CFMap() {} |
---|
51 | CFMap( const List<CanonicalForm> & L ); |
---|
52 | CFMap( const CFMap & m ) : P( m.P ) {} |
---|
53 | CFMap& operator=( const CFMap & m ); |
---|
54 | void newpair( const Variable & v, const CanonicalForm & s ); |
---|
55 | CanonicalForm operator() ( const CanonicalForm & f ) const; |
---|
56 | friend ostream& operator<< ( ostream& s, const CFMap & m ); |
---|
57 | }; |
---|
58 | |
---|
59 | CanonicalForm compress ( const CanonicalForm & f, CFMap & m ); |
---|
60 | void compress ( const CFArray & a, CFMap & M, CFMap & N ); |
---|
61 | void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N ); |
---|
62 | |
---|
63 | /*ENDPUBLIC*/ |
---|
64 | |
---|
65 | #endif /* INCL_CF_MAP_H */ |
---|
66 | |
---|