source: git/coeffs/coeffs.h @ 502f7e8

fieker-DuValspielwiese
Last change on this file since 502f7e8 was 193c6b, checked in by Mohamed Barakat <mohamed.barakat@…>, 14 years ago
- void * as a parameter for registering coefficients :) - two doxygen style comments
  • Property mode set to 100644
File size: 4.8 KB
Line 
1#ifndef COEFFS_H
2#define COEFFS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT
9*/
10
11#include <aux.h>
12
13enum n_coeffType
14{
15  n_unknown=0,
16  n_Zp,
17  n_Q,
18  n_R,
19  n_GF,
20  n_long_R,
21  n_Zp_a,
22  n_Q_a,
23  n_long_C,
24  // only used if HAVE_RINGS is defined
25  n_Z,
26  n_Zm,
27  n_Zpn,
28  n_Z2n
29};
30
31struct n_Procs_s;
32typedef struct  n_Procs_s  n_Procs_s;
33typedef struct  n_Procs_s  *coeffs;
34
35
36
37struct snumber;
38typedef struct snumber *   number;
39typedef number (*numberfunc)(number a, number b, const coeffs r);
40
41/// maps "a", which lives in src, into dst
42typedef number (*nMapFunc)(number a, const coeffs src, const coeffs dst);
43
44struct n_Procs_s
45{
46   coeffs next;
47   unsigned int  ringtype;  /* 0 => coefficient field, 1 => coeffs from Z/2^m */
48
49   // general properties:
50   /// TRUE, if nNew/nDelete/nCopy are dummies
51   BOOLEAN has_simple_Alloc;
52   /// TRUE, if std should make polynomials monic (if nInvers is cheap)
53   /// if false, then a gcd routine is required for a content computation
54   BOOLEAN has_simple_Inverse;
55
56   // tests for numbers.cc:
57   BOOLEAN (*nCoeffIsEqual)(const coeffs r, n_coeffType n, int parameter);
58
59   // the union stuff
60
61   // Zp:
62   int npPrimeM;
63   int npPminus1M;
64   #ifdef HAVE_DIV_MOD
65   unsigned short *npInvTable;
66   #endif
67   #if !defined(HAVE_DIV_MOD) || !defined(HAVE_MULT_MOD)
68   unsigned short *npExpTable;
69   unsigned short *npLogTable;
70   #endif
71   // Zp_a, Q_a
72   // ?
73   // initialisation:
74   void (*cfInitChar)(coeffs r, int parameter); // do one-time initialisations
75   void (*cfKillChar)(coeffs r); //  undo all initialisations
76                                // or NULL
77   void (*cfSetChar)(const coeffs r); // initialisations after each ring change
78                                // or NULL
79   // general stuff
80   numberfunc nMult, nSub ,nAdd ,nDiv, nIntDiv, nIntMod, nExactDiv;
81   /// init with an integer
82   number  (*cfInit)(int i,const coeffs r);
83   number  (*nPar)(int i, const coeffs r);
84   int     (*nParDeg)(number n, const coeffs r);
85   /// how complicated, (0) => 0, or positive
86   int     (*nSize)(number n, const coeffs r);
87   /// convertion, 0 if impossible
88   int     (*n_Int)(number &n, const coeffs r);
89#ifdef HAVE_RINGS
90   int     (*nDivComp)(number a,number b,const coeffs r);
91   BOOLEAN (*nIsUnit)(number a,const coeffs r);
92   number  (*nGetUnit)(number a,const coeffs r);
93   number  (*nExtGcd)(number a, number b, number *s, number *t,const coeffs r);
94#endif
95   /// changes argument  inline: a:= -a
96   number  (*nNeg)(number a, const coeffs r);
97   /// return 1/a
98   number  (*nInvers)(number a, const coeffs r);
99   /// return a copy of a
100   number  (*cfCopy)(number a, const coeffs r);
101   number  (*nRePart)(number a, const coeffs r);
102   number  (*nImPart)(number a, const coeffs r);
103   void    (*cfWrite)(number &a, const coeffs r);
104   const char *  (*nRead)(const char * s, number * a, const coeffs r);
105   void    (*nNormalize)(number &a, const coeffs r);
106   BOOLEAN (*nGreater)(number a,number b, const coeffs r),
107#ifdef HAVE_RINGS
108           (*nDivBy)(number a, number b, const coeffs r),
109#endif
110            /// tests
111           (*nEqual)(number a,number b, const coeffs r),
112           (*nIsZero)(number a, const coeffs r),
113           (*nIsOne)(number a, const coeffs r),
114           (*nIsMOne)(number a, const coeffs r),
115           (*nGreaterZero)(number a, const coeffs r);
116   void    (*nPower)(number a, int i, number * result, const coeffs r);
117   number  (*cfGetDenom)(number &n, const coeffs r);
118   number  (*cfGetNumerator)(number &n, const coeffs r);
119   number  (*nGcd)(number a, number b, const coeffs r);
120   number  (*nLcm)(number a, number b, const coeffs r);
121   void    (*cfDelete)(number * a, const coeffs r);
122   nMapFunc (*cfSetMap)(const coeffs src, const coeffs dst);
123
124   /// For extensions (writes into global string buffer)
125   char *  (*nName)(number n, const coeffs r);
126
127   /// Inline: a := b
128   void    (*nInpMult)(number &a, number b, const coeffs r);
129   number  (*nInit_bigint)(number i, const coeffs src, const coeffs dummy);
130
131#ifdef LDEBUG
132   /// Test: is "a" a correct number?
133   BOOLEAN (*nDBTest)(number a, const char *f,const int l,const coeffs r);
134#endif
135
136   number nNULL; /* the 0 as constant */
137   int     char_flag;
138   int     ref;
139   n_coeffType type;
140////-----------------------------------------
141  char**     parameter; /* names of parameters, rInit */
142  number     minpoly;  /* for Q_a/Zp_a, rInit */
143
144#ifdef HAVE_RINGS
145  int_number    ringflaga; /* Z/(ringflag^ringflagb)=Z/nrnModul*/
146  unsigned long ringflagb;
147  unsigned long nr2mModul;  /* Z/nr2mModul */
148  int_number    nrnModul;
149#endif
150  int        ch;  /* characteristic, rInit */
151
152  short      float_len; /* additional char-flags, rInit */
153  short      float_len2; /* additional char-flags, rInit */
154
155  BOOLEAN   ShortOut; /// ffields need this.
156
157};
158
159#endif
160
Note: See TracBrowser for help on using the repository browser.