source: git/factory/cf_map.h @ 281760

fieker-DuValspielwiese
Last change on this file since 281760 was 95d5c6, checked in by Jens Schmidt <schmidt@…>, 27 years ago
* cf_map.h: doc fix (class CFMap): doc fix * cf_map.h (class CFMap): references to List<CanonicalForm> replaced by CFList * cf_map.h (class MapPair): doc fix git-svn-id: file:///usr/local/Singular/svn/trunk@574 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: cf_map.h,v 1.7 1997-07-23 16:25:08 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_functions.h>
23#include <::templates:ftmpl_list.h>
24#else
25#include "templates/ftmpl_functions.h"
26#include "templates/ftmpl_list.h"
27#endif
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    friend ostream& operator << ( ostream& s, const MapPair & p );
65#endif /* NOSTREAMIO */
66};
67//}}}
68
69typedef List<MapPair> MPList;
70typedef ListIterator<MapPair> MPListIterator;
71
72//{{{ class CFMap
73//{{{ docu
74//
75// class CFMap - class to map canonical forms.
76//
77// Use an object of class CFMap to insert 'values' into canonical
78// form.  Such a mapping is defined by a list of MapPairs (V -> S)
79// describing which canonical form S to insert for variable v.
80// Hereby, the substituted canonical forms are not subject to
81// further substitutions.
82//
83// P: list of MapPairs, sorted by level in descending order
84//
85//}}}
86class CFMap
87{
88private:
89  MPList P;
90public:
91  CFMap() {}
92  CFMap( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {}
93  CFMap( const Variable & v ) : P( MapPair( v, 1 ) ) {}
94  CFMap( const Variable & v, const CanonicalForm & s ) : P( MapPair( v, s ) ) {}
95  ~CFMap() {}
96  CFMap( const CFList & L );
97  CFMap( const CFMap & m ) : P( m.P ) {}
98  CFMap & operator = ( const CFMap & m );
99  void newpair( const Variable & v, const CanonicalForm & s );
100  CanonicalForm operator () ( const CanonicalForm & f ) const;
101#ifndef NOSTREAMIO
102  friend ostream& operator << ( ostream& s, const CFMap & m );
103#endif /* NOSTREAMIO */
104};
105//}}}
106
107CanonicalForm compress ( const CanonicalForm & f, CFMap & m );
108void compress ( const CFArray & a, CFMap & M, CFMap & N );
109void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
110
111/*ENDPUBLIC*/
112
113#endif /* ! INCL_CF_MAP_H */
Note: See TracBrowser for help on using the repository browser.