source: git/factory/cf_map.h @ cd86ac

spielwiese
Last change on this file since cd86ac was 6400f5, checked in by Hans Schönemann <hannes@…>, 24 years ago
* hannes: added dummy routines for debuuging factory/libfac (Singular/claptmpl.cc Singular/fglm.cc Singular/fglm.h Singular/fglmvec.cc Singular/fglmzero.cc Singular/iparith.cc Singular/static.h factory/canonicalform.cc factory/canonicalform.h factory/cf_eval.cc factory/cf_map.cc factory/cf_map.h libfac/charset/charset.cc) git-svn-id: file:///usr/local/Singular/svn/trunk@4409 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.12 2000-05-29 15:05:21 Singular 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    void print( ostream&) const;
59    friend ostream & operator << ( ostream & s, const MapPair & p );
60#endif /* NOSTREAMIO */
61};
62//}}}
63
64typedef List<MapPair> MPList;
65typedef ListIterator<MapPair> MPListIterator;
66
67//{{{ class CFMap
68//{{{ docu
69//
70// class CFMap - class to map canonical forms.
71//
72// Use an object of class CFMap to insert 'values' into canonical
73// form.  Such a mapping is defined by a list of MapPairs (V -> S)
74// describing which canonical form S to insert for variable V.
75// Hereby, the substituted canonical forms are not subject to
76// further substitutions.
77//
78// P: list of MapPairs, sorted by level in descending order
79//
80//}}}
81class CFMap
82{
83private:
84  MPList P;
85public:
86  CFMap () {}
87  CFMap ( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {}
88  CFMap ( const Variable & v ) : P( MapPair( v, 1 ) ) {}
89  CFMap ( const Variable & v, const CanonicalForm & s ) : P( MapPair( v, s ) ) {}
90  ~CFMap () {}
91  CFMap ( const CFList & L );
92  CFMap ( const CFMap & m ) : P( m.P ) {}
93  CFMap & operator = ( const CFMap & m );
94  void newpair ( const Variable & v, const CanonicalForm & s );
95  CanonicalForm operator () ( const CanonicalForm & f ) const;
96#ifndef NOSTREAMIO
97  friend ostream & operator << ( ostream & s, const CFMap & m );
98#endif /* NOSTREAMIO */
99};
100//}}}
101
102CanonicalForm compress ( const CanonicalForm & f, CFMap & m );
103void compress ( const CFArray & a, CFMap & M, CFMap & N );
104void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
105
106/*ENDPUBLIC*/
107
108#endif /* ! INCL_CF_MAP_H */
Note: See TracBrowser for help on using the repository browser.