Changeset 8e0242 in git for coeffs


Ignore:
Timestamp:
May 3, 2010, 1:55:52 PM (14 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
Children:
3aae0e3e34a42ae26c9f4be2d2e8beaefb6268b0
Parents:
88e67079e82b521877fc5e0cb96a457cd3b458dc
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-05-03 13:55:52+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:50:25+01:00
Message:
towards a better initialization of numbers
Location:
coeffs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • coeffs/coeffs.h

    r88e670 r8e0242  
    7474  n_Zp_a,
    7575  n_Q_a,
    76   n_long_C
    77 #ifdef HAVE_RINGS
    78   ,n_Z,
     76  n_long_C,
     77  // only used if HAVE_RINGS is defined
     78  n_Z,
    7979  n_Zm,
    8080  n_Zpn,
    8181  n_Z2n
    82 #endif
    8382};
    8483
     
    111110
    112111   coeffs next;
     112   n_coeffType fieldtype;
     113   unsigned int  ringtype;  /* 0 => coefficient field, 1 => coeffs from Z/2^m */
     114
    113115   // the union stuff
    114116
     
    128130   // general stuff
    129131   numberfunc nMult, nSub ,nAdd ,nDiv, nIntDiv, nIntMod, nExactDiv;
    130    /// init with an integer 
     132   /// init with an integer
    131133   number  (*cfInit)(int i,const coeffs r);
    132134   number  (*nPar)(int i, const coeffs r);
     
    193195
    194196#ifdef HAVE_RINGS
    195   unsigned int  ringtype;  /* cring = 0 => coefficient field, cring = 1 => coeffs from Z/2^m */
    196197  int_number    ringflaga; /* Z/(ringflag^ringflagb)=Z/nrnModul*/
    197198  unsigned long ringflagb;
  • coeffs/mpr_complex.h

    r88e670 r8e0242  
    1515// must have gmp version >= 2
    1616#include "si_gmp.h"
    17 #include "numbers.h"
    1817#include "mpr_global.h"
    1918
  • coeffs/numbers.h

    r88e670 r8e0242  
    7373#define nGetChar() n_GetChar(currRing)
    7474
    75 void nInitChar(coeffs r);
    76 void nKillChar(coeffs r);
    77 void nSetChar(coeffs r);
     75void nInitChar(coeffs r); // do one-time initialisations
     76void nKillChar(coeffs r); // undo all initialisations
     77void nSetChar(coeffs r); // initialisations after each ring chage
    7878
    7979#define nDivBy0 "div by 0"
     
    8383
    8484// Tests:
    85 #ifdef HAVE_RINGS
    8685static inline BOOLEAN nField_is_Ring_2toM(const coeffs r)
    8786{ return (r->ringtype == 1); }
     
    104103static inline BOOLEAN nField_has_Units(const coeffs r)
    105104{ return ((r->ringtype == 1) || (r->ringtype == 2) || (r->ringtype == 3)); }
    106 #else
    107 #define nField_is_Ring(A) (0)
    108 #endif
    109105
    110106
     
    118114
    119115
    120 #ifdef HAVE_RINGS
     116static inline n_coeffType nField_is(const coeffs r)
     117{ return r->fieldtype; }
    121118static inline BOOLEAN nField_is_Zp(const coeffs r)
    122 { return (r->ringtype == 0) && (r->ch > 1) && (r->parameter==NULL); }
     119{ return nField_is(r)==n_Zp; }
    123120
    124121static inline BOOLEAN nField_is_Zp(const coeffs r, int p)
    125 { return (r->ringtype == 0) && (r->ch > 1 && r->ch == ABS(p) && r->parameter==NULL); }
     122{ return (nField_is_Zp(r)  && (r->ch == ABS(p))); }
    126123
    127124static inline BOOLEAN nField_is_Q(const coeffs r)
    128 { return (r->ringtype == 0) && (r->ch == 0) && (r->parameter==NULL); }
    129 
     125{ return nField_is(r)==n_Q; }
    130126
    131127static inline BOOLEAN nField_is_numeric(const coeffs r) /* R, long R, long C */
    132 { return (r->ringtype == 0) && (r->ch ==  -1); }
     128{  return (nField_is(r)==n_R) || (nField_is(r)==n_long_R) || (nField_is(r)==n_long_C); }
    133129
    134130static inline BOOLEAN nField_is_R(const coeffs r)
    135 {
    136   if (nField_is_numeric(r) && (r->float_len <= (short)SHORT_REAL_LENGTH))
    137       return (r->ringtype == 0) && (r->parameter==NULL);
    138   return FALSE;
    139 }
     131{ return nField_is(r)==n_R; }
    140132
    141133static inline BOOLEAN nField_is_GF(const coeffs r)
    142 { return (r->ringtype == 0) && (r->ch > 1) && (r->parameter!=NULL); }
     134{ return nField_is(r)==n_GF; }
    143135
    144136static inline BOOLEAN nField_is_GF(const coeffs r, int q)
    145 { return (r->ringtype == 0) && (r->ch == q); }
     137{ return (nField_is(r)==n_GF) && (r->ch == q); }
    146138
    147139static inline BOOLEAN nField_is_Zp_a(const coeffs r)
     
    155147
    156148static inline BOOLEAN nField_is_long_R(const coeffs r)
    157 {
    158   if (nField_is_numeric(r) && (r->float_len >(short)SHORT_REAL_LENGTH))
    159     return (r->ringtype == 0) && (r->parameter==NULL);
    160   return FALSE;
    161 }
     149{ return nField_is(r)==n_long_R; }
    162150
    163151static inline BOOLEAN nField_is_long_C(const coeffs r)
    164 {
    165   if (nField_is_numeric(r))
    166     return (r->ringtype == 0) && (r->parameter!=NULL);
    167   return FALSE;
    168 }
    169 
    170 #else
    171 
    172 
    173 static inline BOOLEAN nField_is_Zp(const coeffs r)
    174 { return (r->ch > 1) && (r->parameter==NULL); }
    175 
    176 static inline BOOLEAN nField_is_Zp(const coeffs r, int p)
    177 { return (r->ch > 1 && r->ch == ABS(p) && r->parameter==NULL); }
    178 
    179 static inline BOOLEAN nField_is_Q(const coeffs r)
    180 { return (r->ch == 0) && (r->parameter==NULL); }
    181 
    182 static inline BOOLEAN nField_is_numeric(const coeffs r) /* R, long R, long C */
    183 { return (r->ch ==  -1); }
    184 
    185 static inline BOOLEAN nField_is_R(const coeffs r)
    186 {
    187   if (nField_is_numeric(r) && (r->float_len <= (short)SHORT_REAL_LENGTH))
    188     return (r->parameter==NULL);
    189   return FALSE;
    190 }
    191 
    192 static inline BOOLEAN nField_is_GF(const coeffs r)
    193 { return (r->ch > 1) && (r->parameter!=NULL); }
    194 
    195 static inline BOOLEAN nField_is_GF(const coeffs r, int q)
    196 { return (r->ch == q); }
    197 
    198 static inline BOOLEAN nField_is_Zp_a(const coeffs r)
    199 { return (r->ch < -1); }
    200 
    201 static inline BOOLEAN nField_is_Zp_a(const coeffs r, int p)
    202 { return (r->ch < -1 ) && (-(r->ch) == ABS(p)); }
    203 
    204 static inline BOOLEAN nField_is_Q_a(const coeffs r)
    205 { return (r->ch == 1); }
    206 
    207 static inline BOOLEAN nField_is_long_R(const coeffs r)
    208 {
    209   if (nField_is_numeric(r) && (r->float_len >(short)SHORT_REAL_LENGTH))
    210     return (r->parameter==NULL);
    211   return FALSE;
    212 }
    213 
    214 static inline BOOLEAN nField_is_long_C(const coeffs r)
    215 {
    216   if (nField_is_numeric(r))
    217     return (r->parameter!=NULL);
    218   return FALSE;
    219 }
    220 #endif
     152{ return nField_is(r)==n_long_C; }
    221153
    222154static inline BOOLEAN nField_has_simple_inverse(const coeffs r)
Note: See TracChangeset for help on using the changeset viewer.