My Project  debian-1:4.1.2-p1+ds-2
cf_map.h
Go to the documentation of this file.
1 /* emacs edit mode for this file is -*- C++ -*- */
2 
3 #ifndef INCL_CF_MAP_H
4 #define INCL_CF_MAP_H
5 
6 /**
7  * @file cf_map.h
8  *
9  * map polynomials
10  *
11 **/
12 
13 // #include "config.h"
14 
15 #ifndef NOSTREAMIO
16 #ifdef HAVE_IOSTREAM
17 #include <iostream>
18 #define OSTREAM std::ostream
19 #elif defined(HAVE_IOSTREAM_H)
20 #include <iostream.h>
21 #define OSTREAM ostream
22 #endif
23 #endif /* NOSTREAMIO */
24 
25 #include "variable.h"
26 #include "canonicalform.h"
28 
29 /*BEGINPUBLIC*/
30 
31 /** class MapPair
32  *
33  * class MapPair - stores one mapping pair (Variable -> CanonicalForm).
34  *
35  * This class is only used to store such pairs. It has no
36  * methods to transform a CanonicalForm as the class CFMap has.
37  *
38  * V, S: the pair (V -> S)
39  *
40 **/
41 /** inline method
42  *
43  * Variable var () const
44  * CanonicalForm subst () const
45  *
46  * var(), subst() - selectors, return V and P, resp.
47  *
48 **/
49 class MapPair
50 {
51 private:
54 public:
55  MapPair ( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {}
56  MapPair () : V(), S(1) {}
57  MapPair ( const MapPair & p ) : V(p.V), S(p.S) {}
58  ~MapPair () {}
59  MapPair & operator = ( const MapPair & p );
60  Variable var () const { return V; }
61  CanonicalForm subst () const { return S; }
62 #ifndef NOSTREAMIO
63  void print( OSTREAM&) const;
64  friend OSTREAM & operator << ( OSTREAM & s, const MapPair & p );
65 #endif /* NOSTREAMIO */
66 };
67 
70 
71 /** class CFMap
72  *
73  * class CFMap - class to map canonical forms.
74  *
75  * Use an object of class CFMap to insert 'values' into canonical
76  * form. Such a mapping is defined by a list of MapPairs (V -> S)
77  * describing which canonical form S to insert for variable V.
78  * Hereby, the substituted canonical forms are not subject to
79  * further substitutions.
80  *
81  * P: list of MapPairs, sorted by level in descending order
82  *
83 **/
84 class CFMap
85 {
86 private:
88 public:
89  CFMap () {}
90  CFMap ( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {}
91  CFMap ( const Variable & v ) : P( MapPair( v, 1 ) ) {}
92  CFMap ( const Variable & v, const CanonicalForm & s ) : P( MapPair( v, s ) ) {}
93  ~CFMap () {}
94  CFMap ( const CFList & L );
95  CFMap ( const CFMap & m ) : P( m.P ) {}
96  CFMap & operator = ( const CFMap & m );
97  void newpair ( const Variable & v, const CanonicalForm & s );
98  CanonicalForm operator () ( const CanonicalForm & f ) const;
99 #ifndef NOSTREAMIO
100  friend OSTREAM & operator << ( OSTREAM & s, const CFMap & m );
101 #endif /* NOSTREAMIO */
102 };
103 
105 void compress ( const CFArray & a, CFMap & M, CFMap & N );
106 void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
107 
108 /*ENDPUBLIC*/
109 
110 #endif /* ! INCL_CF_MAP_H */
Header for factory's main class CanonicalForm.
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int m
Definition: cfEzgcd.cc:121
int p
Definition: cfModGcd.cc:4019
g
Definition: cfModGcd.cc:4031
#define OSTREAM
Definition: cf_map.h:18
ListIterator< MapPair > MPListIterator
Definition: cf_map.h:69
CanonicalForm compress(const CanonicalForm &f, CFMap &m)
CanonicalForm compress ( const CanonicalForm & f, CFMap & m )
Definition: cf_map.cc:210
List< MapPair > MPList
Definition: cf_map.h:68
FILE * f
Definition: checklibs.c:9
class CFMap
Definition: cf_map.h:85
CFMap(const Variable &v)
Definition: cf_map.h:91
CanonicalForm operator()(const CanonicalForm &f) const
CanonicalForm CFMap::operator () ( const CanonicalForm & f ) const.
Definition: cf_map.cc:178
CFMap(const CFMap &m)
Definition: cf_map.h:95
void newpair(const Variable &v, const CanonicalForm &s)
void CFMap::newpair ( const Variable & v, const CanonicalForm & s )
Definition: cf_map.cc:120
CFMap(const Variable &v, const CanonicalForm &s)
Definition: cf_map.h:92
MPList P
Definition: cf_map.h:87
~CFMap()
Definition: cf_map.h:93
CFMap & operator=(const CFMap &m)
CFMap & CFMap::operator = ( const CFMap & m )
Definition: cf_map.cc:77
CFMap()
Definition: cf_map.h:89
friend OSTREAM & operator<<(OSTREAM &s, const CFMap &m)
OSTREAM & operator << ( OSTREAM & s, const CFMap & m )
Definition: cf_map.cc:191
CFMap(const CanonicalForm &s)
Definition: cf_map.h:90
factory's main class
Definition: canonicalform.h:83
class MapPair
Definition: cf_map.h:50
Variable var() const
Definition: cf_map.h:60
CanonicalForm S
Definition: cf_map.h:53
void print(OSTREAM &) const
Definition: cf_map.cc:50
MapPair(const Variable &v, const CanonicalForm &s)
Definition: cf_map.h:55
MapPair(const MapPair &p)
Definition: cf_map.h:57
friend OSTREAM & operator<<(OSTREAM &s, const MapPair &p)
OSTREAM & operator << ( OSTREAM & s, const MapPair & p )
Definition: cf_map.cc:44
Variable V
Definition: cf_map.h:52
MapPair & operator=(const MapPair &p)
MapPair & MapPair::operator = ( const MapPair & p )
Definition: cf_map.cc:28
~MapPair()
Definition: cf_map.h:58
MapPair()
Definition: cf_map.h:56
CanonicalForm subst() const
Definition: cf_map.h:61
factory's class for variables
Definition: factory.h:118
const CanonicalForm int s
Definition: facAbsFact.cc:55
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define M
Definition: sirandom.c:25
operations on variables