source: git/Singular/structs.h @ d18870

fieker-DuValspielwiese
Last change on this file since d18870 was 8ae6a06, checked in by Hans Schönemann <hannes@…>, 24 years ago
*hannes: moved SHIFTED_EXPONENTS defs git-svn-id: file:///usr/local/Singular/svn/trunk@4141 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.2 KB
Line 
1#ifndef STRUCTS_H
2#define STRUCTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: structs.h,v 1.31 2000-02-10 16:09:04 Singular Exp $ */
7/*
8* ABSTRACT
9*/
10
11/* standard types */
12typedef unsigned char  uchar ;
13typedef unsigned short CARDINAL;
14typedef short BOOLEAN;
15
16typedef void * Sy_reference;
17#define ADDRESS Sy_reference
18#define BITSET  unsigned int
19
20/* EXPONENT_TYPE is determined by configure und defined in mod2.h */
21/* the following defines should really go into mod2.h,
22   but configure dislikes it */
23
24#ifdef HAVE_SHIFTED_EXPONENTS
25/* Define the type of the exponents to be used in monomials */
26#undef EXPONENT_TYPE
27#define EXPONENT_TYPE long
28/* Define the size of exponent */
29#undef SIZEOF_EXPONENT
30#define SIZEOF_EXPONENT SIZEOF_LONG
31#endif
32
33typedef EXPONENT_TYPE Exponent_t;
34
35enum tHomog
36{
37   isNotHomog = FALSE,
38   isHomog    = TRUE,
39   testHomog
40};
41enum noeof_t
42{
43  noeof_brace = 1,
44  noeof_asstring,
45  noeof_block,
46  noeof_bracket,
47  noeof_comment,
48  noeof_procname,
49  noeof_string
50};
51
52/* C++-part */
53#ifdef __cplusplus
54class ip_smatrix;
55class idrec;
56class intvec;
57class sleftv;
58class slists;
59class sattr;
60class skStrategy;
61class ssyStrategy;
62class procinfo;
63class namerec;
64class kBucket;
65#endif
66
67struct  sip_sring;
68struct  sip_sideal;
69struct  sip_link;
70struct  spolynom;
71struct _ssubexpr;
72struct _sssym;
73struct snumber;
74struct sip_command;
75struct sip_package;
76struct s_si_link_extension;
77struct reca;
78struct sip_memHeap;
79struct sip_memHeapPage;
80typedef struct _ssubexpr   sSubexpr;
81typedef struct _sssym      ssym;
82typedef struct spolyrec    polyrec;
83typedef struct snumber     rnumber;
84typedef struct sip_sideal  ip_sideal;
85typedef struct sip_smap    ip_smap;
86typedef struct sip_sring   ip_sring;
87typedef struct sip_link    ip_link;
88typedef struct sip_command ip_command;
89typedef struct sip_package ip_package;
90typedef struct sip_memHeap ip_memHeap;
91
92/* the pointer types */
93typedef char *              char_ptr;
94typedef int  *              int_ptr;
95typedef short *             short_ptr;
96typedef void *              void_ptr;
97typedef ip_sring *         ring;
98typedef int                idtyp;
99typedef rnumber *          number;
100typedef polyrec *          poly;
101typedef poly *             polyset;
102typedef ip_sideal *        ideal;
103typedef ip_smap *          map;
104typedef ideal *            resolvente;
105typedef union uutypes      utypes;
106typedef ip_command *       command;
107typedef struct s_si_link_extension *si_link_extension;
108typedef struct reca *      alg;
109typedef struct sip_memHeap * memHeap;
110typedef struct sip_memHeapPage * memHeapPage;
111
112
113#ifdef __cplusplus
114typedef idrec *            idhdl;
115typedef ip_smatrix *       matrix;
116typedef ip_link *          si_link;
117typedef sleftv *           leftv;
118typedef slists *           lists;
119typedef sSubexpr *         Subexpr;
120typedef sattr *            attr;
121typedef skStrategy *       kStrategy;
122typedef ip_package *       package;
123typedef ssyStrategy *      syStrategy;
124typedef procinfo *         procinfov;
125typedef namerec *          namehdl;
126typedef kBucket*           kBucket_pt;
127
128// for hdegree.cc   
129typedef struct sindlist indlist;
130typedef indlist * indset;
131struct sindlist
132{
133  indset nx;
134  intvec * set;
135};
136
137// for longalg.cc
138struct snaIdeal
139{
140  int anz;
141  alg *liste;
142};
143typedef struct snaIdeal * naIdeal;
144
145
146// for sparsemat.cc
147typedef struct smprec sm_prec;
148typedef sm_prec * smpoly;
149struct smprec{
150  smpoly n;            // the next element
151  int pos;             // position
152  int e;               // level
153  poly m;              // the element
154  float f;             // complexity of the element
155};
156
157struct _scmdnames
158{
159  char *name;
160  short alias;
161  short tokval;
162  short toktype;
163};
164typedef struct _scmdnames cmdnames;
165
166typedef enum
167{
168  ro_dp, // ordering is a degree ordering
169  ro_wp, // ordering is a weighted degree ordering
170  ro_cp, // ordering duplicates variables
171  ro_syzcomp, // ordering indicates "subset" of component number
172  ro_syz, // ordering  with component number >syzcomp is lower
173  ro_none
174}
175ro_typ;
176
177// ordering is a degree ordering
178struct sro_dp
179{
180  short place;  // where degree is stored (in L):
181  short start;  // bounds of ordering (in E):
182  short end;
183};
184typedef struct sro_dp sro_dp;
185
186// ordering is a weighted degree ordering
187struct sro_wp
188{
189  short place;  // where weighted degree is stored (in L)
190  short start;  // bounds of ordering (in E)
191  short end;
192  int *weights; // pointers into wvhdl field
193};
194typedef struct sro_wp sro_wp;
195
196// ordering duplicates variables
197struct sro_cp
198{
199  short place;  // where start is copied to (in E)
200  short start;  // bounds of sources of copied variables (in E)
201  short end;
202};
203typedef struct sro_cp sro_cp;
204
205// ordering indicates "subset" of component number
206struct sro_syzcomp
207{
208  short place;  // where the index is stored (in L)
209  long *ShiftedComponents; // pointer into index field
210  int* Components;
211#ifdef PDEBUG
212  long length;
213#endif
214};
215typedef struct sro_syzcomp sro_syzcomp;
216
217// ordering  with component number >syzcomp is lower
218struct sro_syz
219{
220  short place;       // where the index is stored (in L)
221  int limit;         // syzcomp
222  int* syz_index;    // mapping Component -> SyzIndex for Comp <= limit
223  int  curr_index;   // SyzIndex for Component > limit
224};
225
226typedef struct sro_syz sro_syz;
227
228struct sro_ord
229{
230  ro_typ  ord_typ;
231  union
232  {
233     sro_dp dp;
234     sro_wp wp;
235     sro_cp cp;
236     sro_syzcomp syzcomp;
237     sro_syz syz;
238  } data;
239};
240
241struct sip_sring
242{
243  idhdl      idroot; /* local objects */
244  int*       order;  /* array of orderings */
245  int*       block0; /* starting pos.*/
246  int*       block1; /* ending pos.*/
247  char**     parameter; /* names of parameters */
248  number     minpoly;
249  int**      wvhdl;  /* array of weight vectors */
250  char **    names;  /* array of variable names */
251
252  // what follows below here should be set by rComplete, _only_
253  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
254                       /*  ExpLSize entries*/
255
256  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
257  sro_ord *  typ;   /* array of orderings + sizes, OrdSize entries */
258
259  ideal      qideal; /* extension to the ring structure: qring */
260
261#ifdef HAVE_SHIFTED_EXPONENTS
262  unsigned long bitmask;
263#endif
264
265  int      *VarOffset;
266  /* mapping exp. of var(i) -> p->exp.l */
267#ifdef HAVE_SHIFTED_EXPONENTS
268  /* mapping exp. of var(i) ->
269  p->exp.l[(VarOffset[i] & 0xffffff)] >> (VarOffset[i] >> 24) & bitmask */
270#else
271  /* mapping exp. of var(i) -> p->exp.e[VarOffset[i]] */
272#endif
273
274  memHeap   mm_specHeap; /* Heap from where monoms are allocated */
275  short      ch;     /* characteristic */
276  short      ch_flags; /* additional char-flags */
277
278  short      N;      /* number of vars */
279
280  short      P;      /* number of pars */
281  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise */
282  // what follows below here should be set by rComplete, _only_
283  short      pVarLowIndex;  /* lowest index of a variable */
284  short      pVarHighIndex; /* highest index of a variable */
285                            /* pVarLow to pVarHigh */
286  // contains component, but no weight fields in E */
287  // better: pVarLowIndexE / pVarLowIndexL
288  #ifdef LONG_MONOMS
289  short      pDivLow;
290  short      pDivHigh; /* the same as pVarLow..pVarHigh, */
291                       /* but as index in the 'long' field */
292  #endif
293  short      pCompLowIndex; // better: use pCompareLowIndexL
294  short      pCompHighIndex; /* use p->exp.l[pCompLowIndex..ppCompHighIndex] */
295                             /* for comparing monomials */
296  short      pCompLSize; // pCompHighIndex - pCompLowIndex + 1
297
298  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
299  short      pOrdIndex; /* p->exp.l[pOrdIndex] is pGetOrd(p) */
300
301  short      ExpESize; /* size of exponent vector in Exponent_t */
302  short      ExpLSize; /* size of exponent vector in long */
303  short      OrdSize; /* size of ord vector (in sro_ord) */
304
305  short      ref; /* reference counter to the ring */
306};
307
308struct sip_sideal
309{
310  poly*  m;
311  long rank;
312  int nrows;
313  int ncols;
314  #define IDELEMS(i) ((i)->ncols)
315  inline int& idelems(void) { return ncols; }
316};
317
318struct sip_smap
319{
320  poly *m;
321  char *preimage;
322  int nrows;
323  int ncols;
324};
325#endif /* __cplusplus */
326
327/* the function pointer types */
328typedef number (*numberfunc)(number a,number b);
329
330typedef void    (*pSetmProc)(poly p);
331typedef int     (*pLDegProc)(poly p, int *length);
332typedef int     (*pFDegProc)(poly p);
333typedef int     (*pCompProc)(poly p1, poly p2);
334
335extern ring      currRing;
336
337/*
338**  7. runtime procedures/global data
339*/
340
341/* 7.1 C-routines : */
342
343#ifdef __cplusplus
344extern "C" {
345#endif
346void  m2_end(short i);
347#ifdef __cplusplus
348}
349#endif
350
351/* 7.2 C++-routines : */
352
353#ifdef __cplusplus
354int   inits(void);
355#ifdef buildin_rand
356extern int siSeed;
357int siRand();
358#endif
359#endif
360
361/*the general set of std-options --> kutil.cc */
362extern BITSET test;
363/*the general set of verbose-options --> febase.cc */
364#ifdef __cplusplus
365extern "C" BITSET verbose;
366#else
367extern BITSET verbose;
368#endif
369/*debugging the bison grammar --> grammar.cc*/
370#ifdef YYDEBUG
371#if YYDEBUG
372extern int    yydebug;
373#endif
374#endif
375
376#ifdef HAVE_LIBPARSER
377#ifdef __cplusplus
378class libstack;
379typedef libstack *  libstackv;
380#endif
381#endif /* HAVE_LIBPARSER */
382
383#if HAVE_ASO == 1
384#include "structs.aso"
385#endif
386
387#endif
388
Note: See TracBrowser for help on using the repository browser.