source: git/factory/cf_map.h @ b23c90

spielwiese
Last change on this file since b23c90 was 71da5e, checked in by Jens Schmidt <schmidt@…>, 26 years ago
* ftmpl_array.h, ftmpl_factor.h, ftmpl_functions.h, ftmpl_list.h, ftmpl_matrix.h: new files. #include of `templates/ftmpl_xxx.h' changed to include of `ftmpl_xxx.h'. git-svn-id: file:///usr/local/Singular/svn/trunk@1203 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.11 1998-03-10 14:48:18 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#include "ftmpl_list.h"
22
23/*BEGINPUBLIC*/
24
25//{{{ class MapPair
26//{{{ docu
27//
28// class MapPair - stores one mapping pair (Variable -> CanonicalForm).
29//
30// This class is only used to store such pairs.  It has no
31// methods to transform a CanonicalForm as the class CFMap has.
32//
33// V, S: the pair (V -> S)
34//
35//}}}
36//{{{ inline method docu
37//
38// Variable var () const
39// CanonicalForm subst () const
40//
41// var(), subst() - selectors, return V and P, resp.
42//
43//}}}
44class MapPair
45{
46private:
47    Variable V;
48    CanonicalForm S;
49public:
50    MapPair ( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {}
51    MapPair () : V(), S(1) {}
52    MapPair ( const MapPair & p ) : V(p.V), S(p.S) {}
53    ~MapPair () {}
54    MapPair & operator = ( const MapPair & p );
55    Variable var () const { return V; }
56    CanonicalForm subst () const { return S; }
57#ifndef NOSTREAMIO
58    friend ostream & operator << ( ostream & s, const MapPair & p );
59#endif /* NOSTREAMIO */
60};
61//}}}
62
63typedef List<MapPair> MPList;
64typedef ListIterator<MapPair> MPListIterator;
65
66//{{{ class CFMap
67//{{{ docu
68//
69// class CFMap - class to map canonical forms.
70//
71// Use an object of class CFMap to insert 'values' into canonical
72// form.  Such a mapping is defined by a list of MapPairs (V -> S)
73// describing which canonical form S to insert for variable V.
74// Hereby, the substituted canonical forms are not subject to
75// further substitutions.
76//
77// P: list of MapPairs, sorted by level in descending order
78//
79//}}}
80class CFMap
81{
82private:
83  MPList P;
84public:
85  CFMap () {}
86  CFMap ( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {}
87  CFMap ( const Variable & v ) : P( MapPair( v, 1 ) ) {}
88  CFMap ( const Variable & v, const CanonicalForm & s ) : P( MapPair( v, s ) ) {}
89  ~CFMap () {}
90  CFMap ( const CFList & L );
91  CFMap ( const CFMap & m ) : P( m.P ) {}
92  CFMap & operator = ( const CFMap & m );
93  void newpair ( const Variable & v, const CanonicalForm & s );
94  CanonicalForm operator () ( const CanonicalForm & f ) const;
95#ifndef NOSTREAMIO
96  friend ostream & operator << ( ostream & s, const CFMap & m );
97#endif /* NOSTREAMIO */
98};
99//}}}
100
101CanonicalForm compress ( const CanonicalForm & f, CFMap & m );
102void compress ( const CFArray & a, CFMap & M, CFMap & N );
103void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
104
105/*ENDPUBLIC*/
106
107#endif /* ! INCL_CF_MAP_H */
Note: See TracBrowser for help on using the repository browser.