source: git/kernel/fast_maps.h @ 87beab7

spielwiese
Last change on this file since 87beab7 was ede220f, checked in by Hans Schönemann <hannes@…>, 17 years ago
*hannes: description git-svn-id: file:///usr/local/Singular/svn/trunk@9868 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.6 KB
Line 
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 *  Version: $Id: fast_maps.h,v 1.3 2007-02-20 09:08:37 Singular Exp $
11 *******************************************************************/
12
13/*******************************************************************************
14**
15*S  mapoly, macoeff . . . . . . . . . . . . definition of structs/classes
16*/
17#ifndef FAST_MAPS_HEADER
18#define FAST_MAPS_HEADER
19class macoeff_s;
20class mapoly_s;
21class maideal_s;
22typedef class mapoly_s*  mapoly;
23typedef class macoeff_s* macoeff;
24typedef class maideal_s* maideal;
25
26class mapoly_s
27{
28public:
29  mapoly    next;
30  poly      src;        // monomial from WeightedRing
31  poly      dest;       // poly in CompRing
32  mapoly    f1, f2;     // if f1 != NULL && f2 != NULL then dest = f1*f2
33  int       ref;        // use to catch last usage to save last copy
34  macoeff   coeff;      // list of coeffs to use
35};
36
37class macoeff_s
38{
39public:
40  macoeff       next;
41  number        n;
42  sBucket_pt    bucket;
43};
44
45class maideal_s
46{
47public:
48  int n;
49  sBucket_pt* buckets;
50};
51
52/*******************************************************************************
53**
54*S  definition of basic routines
55*/
56void maMonomial_Out(mapoly monomial, ring src_r, ring dest_r = NULL);
57void maPoly_Out(mapoly mpoly, ring src_ring, ring dest_r = NULL);
58
59// creates a new maMonomial
60// if bucket != NULL, a coeff with the bucket is created, as well
61mapoly maMonomial_Create(poly p, ring , sBucket_pt bucket = NULL);
62// unconditionally destroys a maMonomial:
63// src: LmFree
64// dest: p_Delete
65// coeffs: delete list
66void maMonomial_Destroy(mapoly monomial, ring src_r, ring dest_r = NULL);
67// decrements ref counter, if 0, calls Destroy
68inline mapoly maMonomial_Free(mapoly monomial, ring src_r, ring dest_r = NULL)
69{
70  monomial->ref--;
71  if (monomial->ref <= 0) 
72  { maMonomial_Destroy(monomial, src_r, dest_r); return NULL;}
73  return monomial;
74}
75
76// inserts ("adds") monomial what into poly into
77// returns the maMonomial which was inserted, or, if an equal one was found,
78// the monomial which "swalloed" the monomial
79// It furthermore might reset into
80mapoly maPoly_InsertMonomial(mapoly &into, mapoly what, ring src_r);
81mapoly maPoly_InsertMonomial(mapoly &into, poly p, ring src_r, sBucket_pt bucket = NULL);
82
83// optimizes mpoly for later evaluation
84void maPoly_Optimize(mapoly mpoly, ring src_r);
85
86// evaluates mpoly and destroys it, on the fly
87void maPoly_Eval(mapoly mpoly, ring src_r, ideal dest_id, ring dest_r, int total_cost);
88
89// creates mpoly and  mideal
90void maMap_CreatePolyIdeal(ideal map_id, ring map_r, 
91                           ring src_r, ring dest_r,
92                           mapoly &mp, maideal &mideal);
93// creates src_r: rings with weights
94//         dest_r: where we do our computations
95void maMap_CreateRings(ideal map_id, ring map_r, 
96                       ideal image_id, ring image_r, 
97                       ring &src_r, ring &dest_r, BOOLEAN &no_sort);
98
99// collects tthe results into an ideal and destroys maideal
100ideal maIdeal_2_Ideal(maideal ideal, ring dest_r);
101
102// main routine: map_id: the ideal to map
103//               map_r: the base ring for map_id
104//               image_id: the image of the variables
105//               image_r: the base ring for image_id
106ideal fast_map(ideal map_id, ring map_r, ideal image_id, ring image_r);
107
108#endif
109
110
Note: See TracBrowser for help on using the repository browser.