My Project  debian-1:4.1.2-p1+ds-2
fast_maps.h
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 /***************************************************************
5  * File: fast_maps.cc
6  * Purpose: implementation of fast maps
7  * Author: obachman (Olaf Bachmann), hannes (Hannes Schoenemann),
8  * bricken (Michael Brickenstein)
9  * Created: 01/02
10  *******************************************************************/
11 
12 /*******************************************************************************
13 **
14 *S mapoly, macoeff . . . . . . . . . . . . definition of structs/classes
15 */
16 #ifndef FAST_MAPS_HEADER
17 #define FAST_MAPS_HEADER
18 class macoeff_s;
19 class mapoly_s;
20 class maideal_s;
21 typedef class mapoly_s* mapoly;
22 typedef class macoeff_s* macoeff;
23 typedef class maideal_s* maideal;
24 
25 class mapoly_s
26 {
27 public:
29  poly src; // monomial from WeightedRing
30  poly dest; // poly in CompRing
31  mapoly f1, f2; // if f1 != NULL && f2 != NULL then dest = f1*f2
32  int ref; // use to catch last usage to save last copy
33  macoeff coeff; // list of coeffs to use
34 };
35 
36 class macoeff_s
37 {
38 public:
40  number n;
42 };
43 
44 class maideal_s
45 {
46 public:
47  int n;
49 };
50 
51 /*******************************************************************************
52 **
53 *S definition of basic routines
54 */
55 void maMonomial_Out(mapoly monomial, ring src_r, ring dest_r = NULL);
56 void maPoly_Out(mapoly mpoly, ring src_ring, ring dest_r = NULL);
57 
58 // creates a new maMonomial
59 // if bucket != NULL, a coeff with the bucket is created, as well
60 mapoly maMonomial_Create(poly p, ring , sBucket_pt bucket = NULL);
61 // unconditionally destroys a maMonomial:
62 // src: LmFree
63 // dest: p_Delete
64 // coeffs: delete list
65 void maMonomial_Destroy(mapoly monomial, ring src_r, ring dest_r = NULL);
66 // decrements ref counter, if 0, calls Destroy
67 inline mapoly maMonomial_Free(mapoly monomial, ring src_r, ring dest_r = NULL)
68 {
69  monomial->ref--;
70  if (monomial->ref <= 0)
71  { maMonomial_Destroy(monomial, src_r, dest_r); return NULL;}
72  return monomial;
73 }
74 
75 // inserts ("adds") monomial what into poly into
76 // returns the maMonomial which was inserted, or, if an equal one was found,
77 // the monomial which "swalloed" the monomial
78 // It furthermore might reset into
79 mapoly maPoly_InsertMonomial(mapoly &into, mapoly what, ring src_r);
80 mapoly maPoly_InsertMonomial(mapoly &into, poly p, ring src_r, sBucket_pt bucket = NULL);
81 
82 // optimizes mpoly for later evaluation
83 void maPoly_Optimize(mapoly mpoly, ring src_r);
84 
85 // evaluates mpoly and destroys it, on the fly
86 void maPoly_Eval(mapoly mpoly, ring src_r, ideal dest_id, ring dest_r, int total_cost);
87 
88 // creates mpoly and mideal
89 void maMap_CreatePolyIdeal(ideal map_id, ring map_r,
90  ring src_r, ring dest_r,
91  mapoly &mp, maideal &mideal);
92 // creates src_r: rings with weights
93 // dest_r: where we do our computations
94 void maMap_CreateRings(ideal map_id, ring map_r,
95  ideal image_id, ring image_r,
96  ring &src_r, ring &dest_r, BOOLEAN &no_sort);
97 
98 // collects tthe results into an ideal and destroys maideal
99 ideal maIdeal_2_Ideal(maideal ideal, ring dest_r);
100 
101 // main routine: map_id: the ideal to map
102 // map_r: the base ring for map_id
103 // image_id: the image of the variables
104 ideal fast_map_common_subexp(const ideal map_id,const ring map_r,const ideal image_id,const ring image_r);
105 
106 #endif
107 
108 
int BOOLEAN
Definition: auxiliary.h:87
int p
Definition: cfModGcd.cc:4019
class macoeff_s * macoeff
Definition: fast_maps.h:22
number n
Definition: fast_maps.h:40
macoeff coeff
Definition: fast_maps.h:33
void maMonomial_Out(mapoly monomial, ring src_r, ring dest_r=NULL)
mapoly f1
Definition: fast_maps.h:31
ideal fast_map_common_subexp(const ideal map_id, const ring map_r, const ideal image_id, const ring image_r)
Definition: fast_maps.cc:353
class maideal_s * maideal
Definition: fast_maps.h:23
void maPoly_Out(mapoly mpoly, ring src_ring, ring dest_r=NULL)
sBucket_pt * buckets
Definition: fast_maps.h:48
void maMap_CreateRings(ideal map_id, ring map_r, ideal image_id, ring image_r, ring &src_r, ring &dest_r, BOOLEAN &no_sort)
Definition: fast_maps.cc:280
void maMonomial_Destroy(mapoly monomial, ring src_r, ring dest_r=NULL)
Definition: fast_maps.cc:154
poly dest
Definition: fast_maps.h:30
void maMap_CreatePolyIdeal(ideal map_id, ring map_r, ring src_r, ring dest_r, mapoly &mp, maideal &mideal)
Definition: fast_maps.cc:254
mapoly maPoly_InsertMonomial(mapoly &into, mapoly what, ring src_r)
Definition: fast_maps.cc:183
int ref
Definition: fast_maps.h:32
mapoly next
Definition: fast_maps.h:28
ideal maIdeal_2_Ideal(maideal ideal, ring dest_r)
Definition: fast_maps.cc:322
mapoly maMonomial_Create(poly p, ring, sBucket_pt bucket=NULL)
Definition: fast_maps.cc:137
mapoly f2
Definition: fast_maps.h:31
class mapoly_s * mapoly
Definition: fast_maps.h:21
void maPoly_Eval(mapoly mpoly, ring src_r, ideal dest_id, ring dest_r, int total_cost)
Definition: fast_maps.cc:494
sBucket_pt bucket
Definition: fast_maps.h:41
poly src
Definition: fast_maps.h:29
macoeff next
Definition: fast_maps.h:39
mapoly maMonomial_Free(mapoly monomial, ring src_r, ring dest_r=NULL)
Definition: fast_maps.h:67
void maPoly_Optimize(mapoly mpoly, ring src_r)
Definition: fast_maps.cc:709
#define NULL
Definition: omList.c:12