My Project
Loading...
Searching...
No Matches
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
18class macoeff_s;
19class mapoly_s;
20class maideal_s;
21typedef class mapoly_s* mapoly;
22typedef class macoeff_s* macoeff;
23typedef class maideal_s* maideal;
24
26{
27public:
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
37{
38public:
40 number n;
42};
43
45{
46public:
47 int n;
49};
50
51/*******************************************************************************
52**
53*S definition of basic routines
54*/
55void maMonomial_Out(mapoly monomial, ring src_r, ring dest_r = NULL);
56void 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
60mapoly 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
65void maMonomial_Destroy(mapoly monomial, ring src_r, ring dest_r = NULL);
66// decrements ref counter, if 0, calls Destroy
67inline 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 "swallowed" the monomial
78// It furthermore might reset into
79mapoly maPoly_InsertMonomial(mapoly &into, mapoly what, ring src_r);
80mapoly maPoly_InsertMonomial(mapoly &into, poly p, ring src_r, sBucket_pt bucket = NULL);
81
82// optimizes mpoly for later evaluation
83void maPoly_Optimize(mapoly mpoly, ring src_r);
84
85// evaluates mpoly and destroys it, on the fly
86void maPoly_Eval(mapoly mpoly, ring src_r, ideal dest_id, ring dest_r, int total_cost);
87
88// creates mpoly and mideal
89void 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
94void 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 the results into an ideal and destroys maideal
99ideal 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
104ideal 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:4078
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:354
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:281
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:255
mapoly maPoly_InsertMonomial(mapoly &into, mapoly what, ring src_r)
Definition: fast_maps.cc:184
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:323
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:499
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:714
#define NULL
Definition: omList.c:12