source: git/Singular/structs.h @ 5cfef2

fieker-DuValspielwiese
Last change on this file since 5cfef2 was 0224c8, checked in by Hans Schönemann <hannes@…>, 23 years ago
*hannes napoly git-svn-id: file:///usr/local/Singular/svn/trunk@4827 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 11.9 KB
Line 
1#ifndef STRUCTS_H
2#define STRUCTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: structs.h,v 1.46 2000-12-07 12:07:00 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
25typedef long Exponent_t;
26typedef long Order_t;
27
28enum tHomog
29{
30   isNotHomog = FALSE,
31   isHomog    = TRUE,
32   testHomog
33};
34enum noeof_t
35{
36  noeof_brace = 1,
37  noeof_asstring,
38  noeof_block,
39  noeof_bracket,
40  noeof_comment,
41  noeof_procname,
42  noeof_string
43};
44
45enum n_coeffType
46{
47  n_unknown=0,
48  n_Zp,
49  n_Q,
50  n_R,
51  n_GF,
52  n_long_R,
53  n_Zp_a,
54  n_Q_a,
55  n_long_C
56};
57
58#ifdef HAVE_PLURAL
59enum nc_type
60{
61  nc_general,
62  nc_skew,
63  nc_lie
64};
65#endif
66
67
68/* C++-part */
69#ifdef __cplusplus
70class ip_smatrix;
71class idrec;
72class intvec;
73class sleftv;
74class slists;
75class sattr;
76class skStrategy;
77class ssyStrategy;
78class procinfo;
79class namerec;
80class kBucket;
81#endif
82
83struct n_Procs_s;
84struct sip_sring;
85struct sip_sideal;
86struct sip_link;
87struct spolynom;
88struct _ssubexpr;
89struct _sssym;
90struct snumber;
91struct sip_command;
92struct sip_package;
93struct s_si_link_extension;
94struct reca;
95
96typedef struct  n_Procs_s  n_Procs_s;
97
98#ifdef HAVE_PLURAL
99struct nc_struct;
100typedef struct nc_struct   nc_struct;
101#endif
102
103typedef struct _ssubexpr   sSubexpr;
104typedef struct _sssym      ssym;
105typedef struct spolyrec    polyrec;
106typedef struct snumber     rnumber;
107typedef struct sip_sideal  ip_sideal;
108typedef struct sip_smap    ip_smap;
109typedef struct sip_sring   ip_sring;
110typedef struct sip_link    ip_link;
111typedef struct sip_command ip_command;
112typedef struct sip_package ip_package;
113
114/* the pointer types */
115typedef char *             char_ptr;
116typedef int  *             int_ptr;
117typedef short *            short_ptr;
118typedef void *             void_ptr;
119typedef ip_sring *         ring;
120typedef int                idtyp;
121typedef rnumber *          number;
122typedef polyrec *          poly;
123typedef poly *             polyset;
124typedef ip_sideal *        ideal;
125typedef ip_smap *          map;
126typedef ideal *            resolvente;
127typedef union uutypes      utypes;
128typedef ip_command *       command;
129typedef struct s_si_link_extension *si_link_extension;
130typedef struct reca *      alg;
131#define napoly             alg
132
133#ifdef __cplusplus
134typedef idrec *            idhdl;
135typedef ip_smatrix *       matrix;
136typedef ip_link *          si_link;
137typedef sleftv *           leftv;
138typedef slists *           lists;
139typedef sSubexpr *         Subexpr;
140typedef sattr *            attr;
141typedef skStrategy *       kStrategy;
142typedef ip_package *       package;
143typedef ssyStrategy *      syStrategy;
144typedef procinfo *         procinfov;
145typedef namerec *          namehdl;
146typedef kBucket*           kBucket_pt;
147typedef struct p_Procs_s p_Procs_s;
148
149// for hdegree.cc
150typedef struct sindlist indlist;
151typedef indlist * indset;
152struct sindlist
153{
154  indset nx;
155  intvec * set;
156};
157
158// for longalg.cc
159struct snaIdeal
160{
161  int anz;
162  alg *liste;
163};
164typedef struct snaIdeal * naIdeal;
165
166
167// for sparsemat.cc
168typedef struct smprec sm_prec;
169typedef sm_prec * smpoly;
170struct smprec
171{
172  smpoly n;            // the next element
173  int pos;             // position
174  int e;               // level
175  poly m;              // the element
176  float f;             // complexity of the element
177};
178
179struct _scmdnames
180{
181  char *name;
182  short alias;
183  short tokval;
184  short toktype;
185};
186typedef struct _scmdnames cmdnames;
187
188typedef number (*numberfunc)(number a,number b);
189struct n_Procs_s
190{
191   n_Procs_s* next;
192   int     nChar;
193   n_coeffType type;
194   int     char_flag;
195   int     ref;
196   // the union stuff
197   // Zp:
198   int npPrimeM;
199   int npPminus1M;
200   CARDINAL *npExpTable;
201   CARDINAL *npLogTable;
202   // Zp_a, Q_a
203
204   // general stuff
205   numberfunc nMult, nSub ,nAdd ,nDiv, nIntDiv, nIntMod, nExactDiv;
206   void    (*nNew)(number * a);
207   number  (*nInit)(int i);
208   number  (*nPar)(int i);
209   int     (*nParDeg)(number n);
210   int     (*nSize)(number n);
211   int     (*nInt)(number &n);
212   number  (*nNeg)(number a);
213   number  (*nInvers)(number a);
214   number  (*nCopy)(number a);
215   void    (*nWrite)(number &a);
216   char *  (*nRead)(char * s, number * a);
217   void    (*nNormalize)(number &a);
218   BOOLEAN (*nGreater)(number a,number b),
219           (*nEqual)(number a,number b),
220           (*nIsZero)(number a),
221           (*nIsOne)(number a),
222           (*nIsMOne)(number a),
223           (*nGreaterZero)(number a);
224   void    (*nPower)(number a, int i, number * result);
225   number  (*nGetDenom)(number &n);
226   numberfunc nGcd, nLcm;
227   BOOLEAN (*nSetMap)(ring r);
228#ifdef LDEBUG
229   BOOLEAN (*nDBTest)(number a, char *f, int l);
230   void    (*nDBDelete)(number * a,char *f, int l);
231#else
232   void    (*nDelete)(number * a);
233#endif
234   char *  (*nName)(number n);
235//extern number  (*nMap)(number from);
236
237   number nNULL; /* the 0 as constant */
238};
239
240/* the function pointer types */
241
242extern ring      currRing;
243typedef long     (*pLDegProc)(poly p, int *length, ring r= currRing);
244typedef long     (*pFDegProc)(poly p, ring r = currRing);
245typedef void     (*p_SetmProc)(poly p, ring r = currRing);
246
247typedef enum
248{
249  ro_dp, // ordering is a degree ordering
250  ro_wp, // ordering is a weighted degree ordering
251  ro_wp_neg, // ordering is a weighted degree ordering
252             // with possibly negative weights
253  ro_cp,    // ordering duplicates variables
254  ro_syzcomp, // ordering indicates "subset" of component number
255  ro_syz, // ordering  with component number >syzcomp is lower
256  ro_none
257}
258ro_typ;
259
260// ordering is a degree ordering
261struct sro_dp
262{
263  short place;  // where degree is stored (in L):
264  short start;  // bounds of ordering (in E):
265  short end;
266};
267typedef struct sro_dp sro_dp;
268
269// ordering is a weighted degree ordering
270struct sro_wp
271{
272  short place;  // where weighted degree is stored (in L)
273  short start;  // bounds of ordering (in E)
274  short end;
275  int *weights; // pointers into wvhdl field
276};
277typedef struct sro_wp sro_wp;
278
279// ordering duplicates variables
280struct sro_cp
281{
282  short place;  // where start is copied to (in E)
283  short start;  // bounds of sources of copied variables (in E)
284  short end;
285};
286typedef struct sro_cp sro_cp;
287
288// ordering indicates "subset" of component number
289struct sro_syzcomp
290{
291  short place;  // where the index is stored (in L)
292  long *ShiftedComponents; // pointer into index field
293  int* Components;
294#ifdef PDEBUG
295  long length;
296#endif
297};
298typedef struct sro_syzcomp sro_syzcomp;
299
300// ordering  with component number >syzcomp is lower
301struct sro_syz
302{
303  short place;       // where the index is stored (in L)
304  int limit;         // syzcomp
305  int* syz_index;    // mapping Component -> SyzIndex for Comp <= limit
306  int  curr_index;   // SyzIndex for Component > limit
307};
308
309typedef struct sro_syz sro_syz;
310
311#ifndef OM_ALLOC_H
312struct omBin_s;
313#endif
314
315struct sro_ord
316{
317  ro_typ  ord_typ;
318  union
319  {
320     sro_dp dp;
321     sro_wp wp;
322     sro_cp cp;
323     sro_syzcomp syzcomp;
324     sro_syz syz;
325  } data;
326};
327
328#ifdef HAVE_PLURAL
329struct nc_struct
330{
331  nc_type type;
332  matrix C;
333  matrix D;
334  matrix *MT;
335  int *MTsize;
336};
337#endif
338
339struct sip_sring
340{
341  idhdl      idroot; /* local objects */
342  int*       order;  /* array of orderings */
343  int*       block0; /* starting pos.*/
344  int*       block1; /* ending pos.*/
345  char**     parameter; /* names of parameters */
346  number     minpoly;
347  int**      wvhdl;  /* array of weight vectors */
348  char **    names;  /* array of variable names */
349
350  // what follows below here should be set by rComplete, _only_
351  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
352                       /*  ExpL_Size entries*/
353
354  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
355  sro_ord*   typ;   /* array of orderings + sizes, OrdSize entries */
356
357  ideal      qideal; /* extension to the ring structure: qring */
358
359
360  int      *VarOffset;
361  int*     firstwv;
362
363  struct omBin_s*   PolyBin; /* Bin from where monoms are allocated */
364  short      ch;     /* characteristic */
365  short      ch_flags; /* additional char-flags */
366
367  short      N;      /* number of vars */
368
369  short      P;      /* number of pars */
370  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise */
371
372  short     firstBlockEnds;
373 
374
375  BOOLEAN   VectorOut;
376  BOOLEAN   ShortOut;
377  BOOLEAN   CanShortOut;
378  BOOLEAN   LexOrder;
379  // TRUE if the monomial ordering has polynomial and power series blocks
380  BOOLEAN   MixedOrder;
381  // 1 for lex ordering (except ls), -1 otherwise
382  BOOLEAN   ComponentOrder;
383 
384 
385  // what follows below here should be set by rComplete, _only_
386  // contains component, but no weight fields in E */
387  short      ExpL_Size; // size of exponent vector in long
388  short      CmpL_Size; // portions which need to be compared
389  /* number of long vars in exp vector:
390     long vars are those longs in the exponent vector which are
391     occupied by variables, only */
392  short     VarL_Size;   
393
394  short      BitsPerExp; /* number of bits per exponent */
395  short      ExpPerLong; /* maximal number of Exponents per long */
396
397  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
398  short      pOrdIndex; /* p->exp[pOrdIndex] is pGetOrd(p) */
399
400  short      OrdSize; /* size of ord vector (in sro_ord) */
401
402
403  short      ref; /* reference counter to the ring */
404
405  /* if >= 0, long vars in exp vector are consecutive and start there
406     if <  0, long vars in exp vector are not consecutive */
407  short     VarL_LowIndex;
408  // number of exponents in r->VarL_Offset[0]
409  // is minimal number of exponents in a long var
410  short     MinExpPerLong;
411 
412  /* if this is > 0, then NegWeightL_Offset[0..size_1] is index of longs in
413   ExpVector whose values need an offset due to negative weights */
414  short     NegWeightL_Size;
415  /* array of NegWeigtL_Size indicies */
416  int*      NegWeightL_Offset;
417 
418  /* array of size VarL_Size,
419     VarL_Offset[i] gets i-th long var in exp vector */
420  int*      VarL_Offset;
421
422  /* mask for getting single exponents */
423  unsigned long bitmask;
424  /* mask used for divisiblity tests */
425  unsigned long divmask;
426
427  p_Procs_s*    p_Procs;
428  pFDegProc     pFDeg;
429  pLDegProc     pLDeg;
430  p_SetmProc    p_Setm;
431  n_Procs_s*    cf;
432  ring          algring;
433#ifdef HAVE_PLURAL
434  nc_struct     *nc;
435#endif
436};
437
438struct sip_sideal
439{
440  poly*  m;
441  long rank;
442  int nrows;
443  int ncols;
444  #define IDELEMS(i) ((i)->ncols)
445  inline int& idelems(void) { return ncols; }
446};
447
448struct sip_smap
449{
450  poly *m;
451  char *preimage;
452  int nrows;
453  int ncols;
454};
455#endif /* __cplusplus */
456
457
458
459/*
460**  7. runtime procedures/global data
461*/
462
463/* 7.1 C-routines : */
464
465
466#ifdef __cplusplus
467extern "C" {
468#endif
469void  m2_end(short i);
470#ifdef __cplusplus
471}
472#endif
473
474/* 7.2 C++-routines : */
475
476#ifdef __cplusplus
477int   inits(void);
478#ifdef buildin_rand
479extern int siSeed;
480int siRand();
481#endif
482#endif
483
484/*the general set of std-options --> kutil.cc */
485extern BITSET test;
486/*the general set of verbose-options --> febase.cc */
487#ifdef __cplusplus
488extern "C" BITSET verbose;
489#else
490extern BITSET verbose;
491#endif
492/*debugging the bison grammar --> grammar.cc*/
493#ifdef YYDEBUG
494#if YYDEBUG
495extern int    yydebug;
496#endif
497#endif
498
499#ifdef HAVE_LIBPARSER
500#ifdef __cplusplus
501class libstack;
502typedef libstack *  libstackv;
503#endif
504#endif /* HAVE_LIBPARSER */
505
506extern struct omBin_s* MP_INT_bin;
507extern struct omBin_s* char_ptr_bin;
508extern struct omBin_s* ideal_bin;
509extern struct omBin_s* int_bin;
510extern struct omBin_s* poly_bin;
511extern struct omBin_s* void_ptr_bin;
512extern struct omBin_s* indlist_bin;
513extern struct omBin_s* naIdeal_bin;
514extern struct omBin_s* snaIdeal_bin;
515extern struct omBin_s* sm_prec_bin;
516extern struct omBin_s* smprec_bin;
517extern struct omBin_s* sip_sideal_bin;
518extern struct omBin_s* sip_smap_bin;
519extern struct omBin_s* sip_sring_bin;
520extern struct omBin_s* ip_sideal_bin;
521extern struct omBin_s* ip_smap_bin;
522extern struct omBin_s* ip_sring_bin;
523
524#endif
525
Note: See TracBrowser for help on using the repository browser.