definition of class CFMap.
More...
#include "config.h"
#include "canonicalform.h"
#include "cf_map.h"
#include "cf_iter.h"
#include "templates/ftmpl_functions.h"
Go to the source code of this file.
|
OSTREAM & | operator<< (OSTREAM &s, const MapPair &p) |
| OSTREAM & operator << ( OSTREAM & s, const MapPair & p )
|
|
static int | cmpfunc (const MapPair &p1, const MapPair &p2) |
| static int cmpfunc ( const MapPair & p1, const MapPair & p2 )
|
|
static void | insfunc (MapPair &orgp, const MapPair &newp) |
| static void insfunc ( MapPair & orgp, const MapPair & newp )
|
|
static CanonicalForm | subsrec (const CanonicalForm &f, const MPListIterator &i) |
| static CanonicalForm subsrec ( const CanonicalForm & f, const MPListIterator & i )
|
|
OSTREAM & | operator<< (OSTREAM &s, const CFMap &m) |
| OSTREAM & operator << ( OSTREAM & s, const CFMap & m )
|
|
CanonicalForm | compress (const CanonicalForm &f, CFMap &m) |
| CanonicalForm compress ( const CanonicalForm & f, CFMap & m )
|
|
void | compress (const CFArray &a, CFMap &M, CFMap &N) |
| void compress ( const CFArray & a, CFMap & M, CFMap & N )
|
|
static void | optvalues (const int *df, const int *dg, const int n, int &p1, int &pe) |
|
void | compress (const CanonicalForm &f, const CanonicalForm &g, CFMap &M, CFMap &N) |
| void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N )
|
|
definition of class CFMap.
Used by: cf_gcd.cc, fac_multivar.cc
Definition in file cf_map.cc.
◆ cmpfunc()
static int cmpfunc ( const MapPair & p1, const MapPair & p2 )
cmpfunc() - compare two map pairs.
Return -1 if p2's variable is less than p1's, 0 if they are equal, 1 if p2's level is greater than p1's.
Definition at line 93 of file cf_map.cc.
94{
95 if ( p1.
var() > p2.
var() )
return -1;
96 else if ( p1.
var() == p2.
var() )
return 0;
97 else return 1;
98}
◆ compress() [1/3]
CanonicalForm compress ( const CanonicalForm & f, CFMap & m )
compress() - compress the canonical form f.
Compress the polynomial f such that the levels of its polynomial variables are ordered without any gaps starting from level 1. Return the compressed polynomial and a map m to undo the compression. That is, if f' = compress(f, m), than f = m(f').
Definition at line 210 of file cf_map.cc.
211{
215
219 while(
degs[
i] == 0 )
i++;
221
224 }
226 }
229}
factory's class for variables
◆ compress() [2/3]
void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N )
compress() - compress the variables occurring in f and g with respect to optimal variables
Compress the polynomial variables occurring in f and g so that the levels of variables common to f and g are ordered without any gaps starting from level 1, whereas the variables occuring in only one of f or g are moved to levels higher than the levels of the common variables. Return the CFMap M to realize the compression and its inverse, the CFMap N. N needs only variables common to f and g.
Definition at line 349 of file cf_map.cc.
350{
351 int n =
tmax(
f.level(),
g.level() );
355
356 for (
i = 0;
i <= n;
i++ )
357 {
359 }
360
364
367 {
371 }
373 {
375 {
376 if ( (
i !=
k ) && (
i !=
pe ) && (
i != p1 ) )
377 {
380 }
382 }
384 }
386 {
390 }
393 {
396 {
399 }
400 }
402 {
404 {
407 }
408 }
410 }
411
414}
const CanonicalForm CFMap CFMap & N
static void optvalues(const int *df, const int *dg, const int n, int &p1, int &pe)
template CanonicalForm tmax(const CanonicalForm &, const CanonicalForm &)
◆ compress() [3/3]
void compress ( const CFArray & a, CFMap & M, CFMap & N )
compress() - compress the variables occuring in an a.
Compress the polynomial variables occuring in a so that their levels are ordered without any gaps starting from level 1. Return the CFMap M to realize the compression and its inverse, the CFMap N. Note that if you compress a member of a using M the result of the compression is not necessarily compressed, since the map is constructed using all variables occuring in a.
Definition at line 245 of file cf_map.cc.
246{
249 return;
252
253
254 for (
i = a.
min() + 1;
i <= a.
max();
i++ )
258 return;
259
264
265
267 {
272 }
273
274
277 {
279 {
283 }
285 }
288}
◆ insfunc()
◆ operator<<() [1/2]
OSTREAM & operator << ( OSTREAM & s, const CFMap & m )
operator << - print a CFMap ("( V[1] -> S[1], ..., V[n] -> * S[n] )".
Definition at line 190 of file cf_map.cc.
192{
195}
void print(OSTREAM &) const
const CanonicalForm int s
◆ operator<<() [2/2]
OSTREAM & operator << ( OSTREAM & s, const MapPair & p )
operator << - print a map pair ("V -> S").
Definition at line 43 of file cf_map.cc.
45{
46 s <<
p.var() <<
" -> " <<
p.subst();
48}
◆ optvalues()
Definition at line 296 of file cf_map.cc.
297{
300 do
301 {
304 }
while ( (
df[
i] == 0 ) || (
dg[
i] == 0 ) );
307 {
309 }
310 else
311 {
313 }
315 {
317 if ( (
df[
i] != 0 ) && (
dg[
i] != 0 ) )
318 {
320 {
323 }
324 else
325 {
328 }
329 }
330 }
331}
◆ subsrec()
static CanonicalForm subsrec ( const CanonicalForm & f, const MPListIterator & i )
subsrec() - recursively apply the substitutions in i to f.
Substitutes algebraic variables, too. The substituted expression are not subject to further substitutions.
Used by: CFMap::operator ()().
Definition at line 136 of file cf_map.cc.
137{
138 if (
f.inBaseDomain() )
return f;
140
141
142 while (
j.hasItem() &&
j.getItem().var() >
f.mvar() )
j++;
143
145 if (
j.getItem().var() !=
f.mvar() ) {
146
147
150 for (
I =
f;
I.hasTerms();
I++ )
153 }
154 else {
155
156
160
162 for (
I =
f;
I.hasTerms();
I++ )
165 }
166 else
168}
static CanonicalForm subsrec(const CanonicalForm &f, const MPListIterator &i)
static CanonicalForm subsrec ( const CanonicalForm & f, const MPListIterator & i )
class to iterate through CanonicalForm's