[493c477] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
| 2 | /* $Id: cf_map.h,v 1.4 1997-06-19 12:24:15 schmidt Exp $ */ |
---|
[2dd068] | 3 | |
---|
| 4 | #ifndef INCL_CF_MAP_H |
---|
| 5 | #define INCL_CF_MAP_H |
---|
| 6 | |
---|
[b973c0] | 7 | #include <config.h> |
---|
| 8 | |
---|
[997ae52] | 9 | #ifndef NOSTREAMIO |
---|
[2dd068] | 10 | #include <iostream.h> |
---|
[997ae52] | 11 | #endif /* NOSTREAMIO */ |
---|
| 12 | |
---|
[2dd068] | 13 | #include "variable.h" |
---|
| 14 | #include "templates/list.h" |
---|
| 15 | #include "canonicalform.h" |
---|
| 16 | |
---|
| 17 | /*BEGINPUBLIC*/ |
---|
| 18 | |
---|
| 19 | class MapPair |
---|
| 20 | { |
---|
| 21 | private: |
---|
| 22 | Variable V; |
---|
| 23 | CanonicalForm S; |
---|
| 24 | public: |
---|
| 25 | MapPair( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {} |
---|
| 26 | MapPair() : V(), S(1) {} |
---|
| 27 | MapPair( const MapPair & p ) : V(p.V), S(p.S) {} |
---|
| 28 | ~MapPair() {} |
---|
| 29 | MapPair& operator=( const MapPair & p ); |
---|
| 30 | Variable var() const { return V; } |
---|
| 31 | CanonicalForm subst() const { return S; } |
---|
[997ae52] | 32 | #ifndef NOSTREAMIO |
---|
[2dd068] | 33 | friend ostream& operator << ( ostream& s, const MapPair & p ); |
---|
[997ae52] | 34 | #endif /* NOSTREAMIO */ |
---|
[2dd068] | 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; |
---|
[997ae52] | 56 | #ifndef NOSTREAMIO |
---|
[2dd068] | 57 | friend ostream& operator<< ( ostream& s, const CFMap & m ); |
---|
[997ae52] | 58 | #endif /* NOSTREAMIO */ |
---|
[2dd068] | 59 | }; |
---|
| 60 | |
---|
| 61 | CanonicalForm compress ( const CanonicalForm & f, CFMap & m ); |
---|
| 62 | void compress ( const CFArray & a, CFMap & M, CFMap & N ); |
---|
[cc3e5e] | 63 | void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N ); |
---|
[2dd068] | 64 | |
---|
| 65 | /*ENDPUBLIC*/ |
---|
| 66 | |
---|
[493c477] | 67 | #endif /* ! INCL_CF_MAP_H */ |
---|