Loading...
Searching...
No Matches
cf_map.h
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#ifndef INCL_CF_MAP_H
#define INCL_CF_MAP_H
/**
* @file cf_map.h
*
* map polynomials
*
**/
// #include "config.h"
#ifndef NOSTREAMIO
#ifdef HAVE_IOSTREAM
#include <iostream>
#define OSTREAM std::ostream
#elif defined(HAVE_IOSTREAM_H)
#include <iostream.h>
#define OSTREAM ostream
#endif
#endif /* NOSTREAMIO */
#include "variable.h"
#include "canonicalform.h"
#include "factory/templates/ftmpl_list.h"
/*BEGINPUBLIC*/
/** class MapPair
*
* class MapPair - stores one mapping pair (Variable -> CanonicalForm).
*
* This class is only used to store such pairs. It has no
* methods to transform a CanonicalForm as the class CFMap has.
*
* V, S: the pair (V -> S)
*
**/
/** inline method
*
* Variable var () const
* CanonicalForm subst () const
*
* var(), subst() - selectors, return V and P, resp.
*
**/
class MapPair
{
private:
Variable V;
CanonicalForm S;
public:
MapPair ( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {}
MapPair () : V(), S(1) {}
MapPair ( const MapPair & p ) : V(p.V), S(p.S) {}
~MapPair () {}
MapPair & operator = ( const MapPair & p );
Variable var () const { return V; }
CanonicalForm subst () const { return S; }
#ifndef NOSTREAMIO
void print( OSTREAM&) const;
friend OSTREAM & operator << ( OSTREAM & s, const MapPair & p );
#endif /* NOSTREAMIO */
};
typedef List<MapPair> MPList;
typedef ListIterator<MapPair> MPListIterator;
/** class CFMap
*
* class CFMap - class to map canonical forms.
*
* Use an object of class CFMap to insert 'values' into canonical
* form. Such a mapping is defined by a list of MapPairs (V -> S)
* describing which canonical form S to insert for variable V.
* Hereby, the substituted canonical forms are not subject to
* further substitutions.
*
* P: list of MapPairs, sorted by level in descending order
*
**/
class CFMap
{
private:
MPList P;
public:
CFMap () {}
CFMap ( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {}
CFMap ( const Variable & v ) : P( MapPair( v, 1 ) ) {}
CFMap ( const Variable & v, const CanonicalForm & s ) : P( MapPair( v, s ) ) {}
~CFMap () {}
CFMap ( const CFList & L );
CFMap ( const CFMap & m ) : P( m.P ) {}
CFMap & operator = ( const CFMap & m );
void newpair ( const Variable & v, const CanonicalForm & s );
CanonicalForm operator () ( const CanonicalForm & f ) const;
#ifndef NOSTREAMIO
friend OSTREAM & operator << ( OSTREAM & s, const CFMap & m );
#endif /* NOSTREAMIO */
};
CanonicalForm compress ( const CanonicalForm & f, CFMap & m );
void compress ( const CFArray & a, CFMap & M, CFMap & N );
void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
/*ENDPUBLIC*/
#endif /* ! INCL_CF_MAP_H */
canonicalform.h
Header for factory's main class CanonicalForm.
OSTREAM
#define OSTREAM
Definition canonicalform.h:16
CFArray
Array< CanonicalForm > CFArray
Definition canonicalform.h:397
CFList
List< CanonicalForm > CFList
Definition canonicalform.h:395
N
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
m
int m
Definition cfEzgcd.cc:128
p
int p
Definition cfModGcd.cc:4086
g
g
Definition cfModGcd.cc:4098
MPListIterator
ListIterator< MapPair > MPListIterator
Definition cf_map.h:69
compress
CanonicalForm compress(const CanonicalForm &f, CFMap &m)
CanonicalForm compress ( const CanonicalForm & f, CFMap & m ).
Definition cf_map.cc:210
MPList
List< MapPair > MPList
Definition cf_map.h:68
f
FILE * f
Definition checklibs.c:9
CFMap
class CFMap
Definition cf_map.h:85
CFMap::CFMap
CFMap(const Variable &v)
Definition cf_map.h:91
CFMap::operator()
CanonicalForm operator()(const CanonicalForm &f) const
CanonicalForm CFMap::operator () ( const CanonicalForm & f ) const.
Definition cf_map.cc:178
CFMap::CFMap
CFMap(const CFMap &m)
Definition cf_map.h:95
CFMap::newpair
void newpair(const Variable &v, const CanonicalForm &s)
void CFMap::newpair ( const Variable & v, const CanonicalForm & s )
Definition cf_map.cc:120
CFMap::CFMap
CFMap(const Variable &v, const CanonicalForm &s)
Definition cf_map.h:92
CFMap::operator<<
friend OSTREAM & operator<<(OSTREAM &s, const CFMap &m)
OSTREAM & operator << ( OSTREAM & s, const CFMap & m ).
Definition cf_map.cc:191
CFMap::P
MPList P
Definition cf_map.h:87
CFMap::~CFMap
~CFMap()
Definition cf_map.h:93
CFMap::operator=
CFMap & operator=(const CFMap &m)
CFMap & CFMap::operator = ( const CFMap & m ).
Definition cf_map.cc:77
CFMap::CFMap
CFMap()
Definition cf_map.h:89
CFMap::CFMap
CFMap(const CanonicalForm &s)
Definition cf_map.h:90
CanonicalForm
factory's main class
Definition canonicalform.h:86
ListIterator
Definition ftmpl_list.h:87
List
Definition ftmpl_list.h:52
MapPair
class MapPair
Definition cf_map.h:50
MapPair::var
Variable var() const
Definition cf_map.h:60
MapPair::S
CanonicalForm S
Definition cf_map.h:53
MapPair::print
void print(OSTREAM &) const
Definition cf_map.cc:50
MapPair::MapPair
MapPair(const Variable &v, const CanonicalForm &s)
Definition cf_map.h:55
MapPair::operator<<
friend OSTREAM & operator<<(OSTREAM &s, const MapPair &p)
OSTREAM & operator << ( OSTREAM & s, const MapPair & p ).
Definition cf_map.cc:44
MapPair::MapPair
MapPair(const MapPair &p)
Definition cf_map.h:57
MapPair::V
Variable V
Definition cf_map.h:52
MapPair::operator=
MapPair & operator=(const MapPair &p)
MapPair & MapPair::operator = ( const MapPair & p ).
Definition cf_map.cc:28
MapPair::~MapPair
~MapPair()
Definition cf_map.h:58
MapPair::MapPair
MapPair()
Definition cf_map.h:56
MapPair::subst
CanonicalForm subst() const
Definition cf_map.h:61
Variable
factory's class for variables
Definition factory.h:127
s
const CanonicalForm int s
Definition facAbsFact.cc:51
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
ftmpl_list.h
MPList
List< MapPair > MPList
Definition factory.h:986
M
#define M
Definition sirandom.c:25
variable.h
operations on variables