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

spielwiese
Last change on this file since 5ecf042 was 5ecf042, checked in by Olaf Bachmann <obachman@…>, 23 years ago
* LIB: some categoy changes * libparse: added -c option * reimplementation of reing dpenendent options (put to ring->options) git-svn-id: file:///usr/local/Singular/svn/trunk@4952 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 12.2 KB
Line 
1#ifndef STRUCTS_H
2#define STRUCTS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: structs.h,v 1.50 2000-12-19 18:31:46 obachman 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);
189typedef number (*nMapFunc)(number a);
190struct n_Procs_s
191{
192   n_Procs_s* next;
193   int     nChar;
194   n_coeffType type;
195   int     char_flag;
196   int     ref;
197   // the union stuff
198   // Zp:
199   int npPrimeM;
200   int npPminus1M;
201   CARDINAL *npExpTable;
202   CARDINAL *npLogTable;
203   // Zp_a, Q_a
204
205   // general stuff
206   numberfunc nMult, nSub ,nAdd ,nDiv, nIntDiv, nIntMod, nExactDiv;
207   void    (*nNew)(number * a);
208   number  (*nInit)(int i);
209   number  (*nPar)(int i);
210   int     (*nParDeg)(number n);
211   int     (*nSize)(number n);
212   int     (*nInt)(number &n);
213   number  (*nNeg)(number a);
214   number  (*nInvers)(number a);
215   number  (*nCopy)(number a);
216   number  (*nRePart)(number a);
217   number  (*nImPart)(number a);
218   void    (*nWrite)(number &a);
219   char *  (*nRead)(char * s, number * a);
220   void    (*nNormalize)(number &a);
221   BOOLEAN (*nGreater)(number a,number b),
222           (*nEqual)(number a,number b),
223           (*nIsZero)(number a),
224           (*nIsOne)(number a),
225           (*nIsMOne)(number a),
226           (*nGreaterZero)(number a);
227   void    (*nPower)(number a, int i, number * result);
228   number  (*nGetDenom)(number &n);
229   numberfunc nGcd, nLcm;
230   nMapFunc (*nSetMap)(ring src, ring dst);
231#ifdef LDEBUG
232   BOOLEAN (*nDBTest)(number a, char *f, int l);
233   void    (*nDBDelete)(number * a,char *f, int l);
234#else
235   void    (*nDelete)(number * a);
236#endif
237   char *  (*nName)(number n);
238//extern number  (*nMap)(number from);
239
240   number nNULL; /* the 0 as constant */
241};
242
243/* the function pointer types */
244
245extern ring      currRing;
246typedef long     (*pLDegProc)(poly p, int *length, ring r= currRing);
247typedef long     (*pFDegProc)(poly p, ring r = currRing);
248typedef void     (*p_SetmProc)(poly p, ring r = currRing);
249
250typedef enum
251{
252  ro_dp, // ordering is a degree ordering
253  ro_wp, // ordering is a weighted degree ordering
254  ro_wp_neg, // ordering is a weighted degree ordering
255             // with possibly negative weights
256  ro_cp,    // ordering duplicates variables
257  ro_syzcomp, // ordering indicates "subset" of component number
258  ro_syz, // ordering  with component number >syzcomp is lower
259  ro_none
260}
261ro_typ;
262
263// ordering is a degree ordering
264struct sro_dp
265{
266  short place;  // where degree is stored (in L):
267  short start;  // bounds of ordering (in E):
268  short end;
269};
270typedef struct sro_dp sro_dp;
271
272// ordering is a weighted degree ordering
273struct sro_wp
274{
275  short place;  // where weighted degree is stored (in L)
276  short start;  // bounds of ordering (in E)
277  short end;
278  int *weights; // pointers into wvhdl field
279};
280typedef struct sro_wp sro_wp;
281
282// ordering duplicates variables
283struct sro_cp
284{
285  short place;  // where start is copied to (in E)
286  short start;  // bounds of sources of copied variables (in E)
287  short end;
288};
289typedef struct sro_cp sro_cp;
290
291// ordering indicates "subset" of component number
292struct sro_syzcomp
293{
294  short place;  // where the index is stored (in L)
295  long *ShiftedComponents; // pointer into index field
296  int* Components;
297#ifdef PDEBUG
298  long length;
299#endif
300};
301typedef struct sro_syzcomp sro_syzcomp;
302
303// ordering  with component number >syzcomp is lower
304struct sro_syz
305{
306  short place;       // where the index is stored (in L)
307  int limit;         // syzcomp
308  int* syz_index;    // mapping Component -> SyzIndex for Comp <= limit
309  int  curr_index;   // SyzIndex for Component > limit
310};
311
312typedef struct sro_syz sro_syz;
313
314#ifndef OM_ALLOC_H
315struct omBin_s;
316#endif
317
318struct sro_ord
319{
320  ro_typ  ord_typ;
321  int     order_index; // comes from r->order[order_index]
322  union
323  {
324     sro_dp dp;
325     sro_wp wp;
326     sro_cp cp;
327     sro_syzcomp syzcomp;
328     sro_syz syz;
329  } data;
330};
331
332#ifdef HAVE_PLURAL
333struct nc_struct
334{
335  nc_type type;
336  matrix C;
337  matrix D;
338  matrix *MT;
339  int *MTsize;
340};
341#endif
342
343struct sip_sring
344{
345  idhdl      idroot; /* local objects */
346  int*       order;  /* array of orderings */
347  int*       block0; /* starting pos.*/
348  int*       block1; /* ending pos.*/
349  char**     parameter; /* names of parameters */
350  number     minpoly;
351  int**      wvhdl;  /* array of weight vectors */
352  char **    names;  /* array of variable names */
353
354  unsigned long options; /* ring dependent options */
355
356  // what follows below here should be set by rComplete, _only_
357  long      *ordsgn;  /* array of +/- 1 (or 0) for comparing monomials */
358                       /*  ExpL_Size entries*/
359
360  // is NULL for lp or N == 1, otherwise non-NULL (with OrdSize > 0 entries) */
361  sro_ord*   typ;   /* array of orderings + sizes, OrdSize entries */
362
363  ideal      qideal; /* extension to the ring structure: qring */
364
365
366  int      *VarOffset;
367  int*     firstwv;
368
369  struct omBin_s*   PolyBin; /* Bin from where monoms are allocated */
370  short      ch;     /* characteristic */
371  short      ch_flags; /* additional char-flags */
372
373  short      N;      /* number of vars */
374
375  short      P;      /* number of pars */
376  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise */
377
378  short     firstBlockEnds;
379 
380
381  BOOLEAN   VectorOut;
382  BOOLEAN   ShortOut;
383  BOOLEAN   CanShortOut;
384  BOOLEAN   LexOrder;
385  // TRUE if the monomial ordering has polynomial and power series blocks
386  BOOLEAN   MixedOrder;
387  // 1 for lex ordering (except ls), -1 otherwise
388  BOOLEAN   ComponentOrder;
389 
390 
391  // what follows below here should be set by rComplete, _only_
392  // contains component, but no weight fields in E */
393  short      ExpL_Size; // size of exponent vector in long
394  short      CmpL_Size; // portions which need to be compared
395  /* number of long vars in exp vector:
396     long vars are those longs in the exponent vector which are
397     occupied by variables, only */
398  short     VarL_Size;   
399
400  short      BitsPerExp; /* number of bits per exponent */
401  short      ExpPerLong; /* maximal number of Exponents per long */
402
403  short      pCompIndex; /* p->exp.e[pCompIndex] is the component */
404  short      pOrdIndex; /* p->exp[pOrdIndex] is pGetOrd(p) */
405
406  short      OrdSize; /* size of ord vector (in sro_ord) */
407
408
409  short      ref; /* reference counter to the ring */
410
411  /* if >= 0, long vars in exp vector are consecutive and start there
412     if <  0, long vars in exp vector are not consecutive */
413  short     VarL_LowIndex;
414  // number of exponents in r->VarL_Offset[0]
415  // is minimal number of exponents in a long var
416  short     MinExpPerLong;
417 
418  /* if this is > 0, then NegWeightL_Offset[0..size_1] is index of longs in
419   ExpVector whose values need an offset due to negative weights */
420  short     NegWeightL_Size;
421  /* array of NegWeigtL_Size indicies */
422  int*      NegWeightL_Offset;
423 
424  /* array of size VarL_Size,
425     VarL_Offset[i] gets i-th long var in exp vector */
426  int*      VarL_Offset;
427
428  /* mask for getting single exponents */
429  unsigned long bitmask;
430  /* mask used for divisiblity tests */
431  unsigned long divmask;
432
433  p_Procs_s*    p_Procs;
434  pFDegProc     pFDeg;
435  pLDegProc     pLDeg;
436  p_SetmProc    p_Setm;
437  n_Procs_s*    cf;
438  ring          algring;
439#ifdef HAVE_PLURAL
440  nc_struct     *nc;
441#endif
442};
443
444struct sip_sideal
445{
446  poly*  m;
447  long rank;
448  int nrows;
449  int ncols;
450  #define IDELEMS(i) ((i)->ncols)
451  inline int& idelems(void) { return ncols; }
452};
453
454struct sip_smap
455{
456  poly *m;
457  char *preimage;
458  int nrows;
459  int ncols;
460};
461#endif /* __cplusplus */
462
463
464
465/*
466**  7. runtime procedures/global data
467*/
468
469/* 7.1 C-routines : */
470
471
472#ifdef __cplusplus
473extern "C" {
474#endif
475void  m2_end(short i);
476#ifdef __cplusplus
477}
478#endif
479
480/* 7.2 C++-routines : */
481
482#ifdef __cplusplus
483int   inits(void);
484#ifdef buildin_rand
485extern int siSeed;
486int siRand();
487#endif
488#endif
489
490/*the general set of std-options --> kutil.cc */
491extern BITSET test;
492/*the general set of verbose-options --> febase.cc */
493#ifdef __cplusplus
494extern "C" BITSET verbose;
495#else
496extern BITSET verbose;
497#endif
498/*debugging the bison grammar --> grammar.cc*/
499#ifdef YYDEBUG
500#if YYDEBUG
501extern int    yydebug;
502#endif
503#endif
504
505#ifdef HAVE_LIBPARSER
506#ifdef __cplusplus
507class libstack;
508typedef libstack *  libstackv;
509#endif
510#endif /* HAVE_LIBPARSER */
511
512extern struct omBin_s* MP_INT_bin;
513extern struct omBin_s* char_ptr_bin;
514extern struct omBin_s* ideal_bin;
515extern struct omBin_s* int_bin;
516extern struct omBin_s* poly_bin;
517extern struct omBin_s* void_ptr_bin;
518extern struct omBin_s* indlist_bin;
519extern struct omBin_s* naIdeal_bin;
520extern struct omBin_s* snaIdeal_bin;
521extern struct omBin_s* sm_prec_bin;
522extern struct omBin_s* smprec_bin;
523extern struct omBin_s* sip_sideal_bin;
524extern struct omBin_s* sip_smap_bin;
525extern struct omBin_s* sip_sring_bin;
526extern struct omBin_s* ip_sideal_bin;
527extern struct omBin_s* ip_smap_bin;
528extern struct omBin_s* ip_sring_bin;
529
530#endif
531
Note: See TracBrowser for help on using the repository browser.