source: git/factory/cf_map.h @ 7ae51b

spielwiese
Last change on this file since 7ae51b was 7ae51b, checked in by Jens Schmidt <schmidt@…>, 27 years ago
* cf_map.h: superfluous '#include "templates/ftmpl_functions.h"' removed git-svn-id: file:///usr/local/Singular/svn/trunk@633 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id: cf_map.h,v 1.8 1997-08-28 07:22:39 schmidt Exp $ */
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#include <iostream.h>
17#endif /* NOSTREAMIO */
18
19#include "variable.h"
20#include "canonicalform.h"
21#ifdef macintosh
22#include <::templates:ftmpl_list.h>
23#else
24#include "templates/ftmpl_list.h"
25#endif
26
27/*BEGINPUBLIC*/
28
29//{{{ class MapPair
30//{{{ docu
31//
32// class MapPair - stores one mapping pair (Variable -> CanonicalForm).
33//
34// This class is only used to store such pairs.  It has no
35// methods to transform a CanonicalForm as the class CFMap has.
36//
37// V, S: the pair (V -> S)
38//
39//}}}
40//{{{ inline method docu
41//
42// Variable var() const
43// CanonicalForm subst() const
44//
45// var(), subst() - selectors, return V and P, resp.
46//
47//}}}
48class MapPair
49{
50private:
51    Variable V;
52    CanonicalForm S;
53public:
54    MapPair( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {}
55    MapPair() : V(), S(1) {}
56    MapPair( const MapPair & p ) : V(p.V), S(p.S) {}
57    ~MapPair() {}
58    MapPair& operator = ( const MapPair & p );
59    Variable var() const { return V; }
60    CanonicalForm subst() const { return S; }
61#ifndef NOSTREAMIO
62    friend ostream& operator << ( ostream& s, const MapPair & p );
63#endif /* NOSTREAMIO */
64};
65//}}}
66
67typedef List<MapPair> MPList;
68typedef ListIterator<MapPair> MPListIterator;
69
70//{{{ class CFMap
71//{{{ docu
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//}}}
84class CFMap
85{
86private:
87  MPList P;
88public:
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//}}}
104
105CanonicalForm compress ( const CanonicalForm & f, CFMap & m );
106void compress ( const CFArray & a, CFMap & M, CFMap & N );
107void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
108
109/*ENDPUBLIC*/
110
111#endif /* ! INCL_CF_MAP_H */
Note: See TracBrowser for help on using the repository browser.