source: git/factory/cf_map.h @ 6db552

spielwiese
Last change on this file since 6db552 was 6db552, checked in by Hans Schoenemann <hannes@…>, 13 years ago
removed include-wrapppers git-svn-id: file:///usr/local/Singular/svn/trunk@13772 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
3
4#ifndef INCL_CF_MAP_H
5#define INCL_CF_MAP_H
6
7//{{{ docu
8//
9// cf_map.h - header to cf_map.cc.
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"
27#include "templates/ftmpl_list.h"
28
29/*BEGINPUBLIC*/
30
31//{{{ class MapPair
32//{{{ docu
33//
34// class MapPair - stores one mapping pair (Variable -> CanonicalForm).
35//
36// This class is only used to store such pairs.  It has no
37// methods to transform a CanonicalForm as the class CFMap has.
38//
39// V, S: the pair (V -> S)
40//
41//}}}
42//{{{ inline method docu
43//
44// Variable var () const
45// CanonicalForm subst () const
46//
47// var(), subst() - selectors, return V and P, resp.
48//
49//}}}
50class MapPair
51{
52private:
53    Variable V;
54    CanonicalForm S;
55public:
56    MapPair ( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {}
57    MapPair () : V(), S(1) {}
58    MapPair ( const MapPair & p ) : V(p.V), S(p.S) {}
59    ~MapPair () {}
60    MapPair & operator = ( const MapPair & p );
61    Variable var () const { return V; }
62    CanonicalForm subst () const { return S; }
63#ifndef NOSTREAMIO
64    void print( OSTREAM&) const;
65    friend OSTREAM & operator << ( OSTREAM & s, const MapPair & p );
66#endif /* NOSTREAMIO */
67};
68//}}}
69
70typedef List<MapPair> MPList;
71typedef ListIterator<MapPair> MPListIterator;
72
73//{{{ class CFMap
74//{{{ docu
75//
76// class CFMap - class to map canonical forms.
77//
78// Use an object of class CFMap to insert 'values' into canonical
79// form.  Such a mapping is defined by a list of MapPairs (V -> S)
80// describing which canonical form S to insert for variable V.
81// Hereby, the substituted canonical forms are not subject to
82// further substitutions.
83//
84// P: list of MapPairs, sorted by level in descending order
85//
86//}}}
87class CFMap
88{
89private:
90  MPList P;
91public:
92  CFMap () {}
93  CFMap ( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {}
94  CFMap ( const Variable & v ) : P( MapPair( v, 1 ) ) {}
95  CFMap ( const Variable & v, const CanonicalForm & s ) : P( MapPair( v, s ) ) {}
96  ~CFMap () {}
97  CFMap ( const CFList & L );
98  CFMap ( const CFMap & m ) : P( m.P ) {}
99  CFMap & operator = ( const CFMap & m );
100  void newpair ( const Variable & v, const CanonicalForm & s );
101  CanonicalForm operator () ( const CanonicalForm & f ) const;
102#ifndef NOSTREAMIO
103  friend OSTREAM & operator << ( OSTREAM & s, const CFMap & m );
104#endif /* NOSTREAMIO */
105};
106//}}}
107
108CanonicalForm compress ( const CanonicalForm & f, CFMap & m );
109void compress ( const CFArray & a, CFMap & M, CFMap & N );
110void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
111
112/*ENDPUBLIC*/
113
114#endif /* ! INCL_CF_MAP_H */
Note: See TracBrowser for help on using the repository browser.