source: git/kernel/fast_maps.h @ fbc7cb

jengelh-datetimespielwiese
Last change on this file since fbc7cb was a9c298, checked in by Hans Schoenemann <hannes@…>, 9 years ago
format stuff
  • Property mode set to 100644
File size: 3.5 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 *******************************************************************/
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
25class mapoly_s
26{
27public:
28  mapoly    next;
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
36class macoeff_s
37{
38public:
39  macoeff       next;
40  number        n;
41  sBucket_pt    bucket;
42};
43
44class maideal_s
45{
46public:
47  int n;
48  sBucket_pt* buckets;
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 "swalloed" 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 tthe 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
104//               image_r: the base ring for image_id
105ideal fast_map(ideal map_id, ring map_r, ideal image_id, ring image_r);
106
107#endif
108
109
Note: See TracBrowser for help on using the repository browser.