Changeset 73a9ffb in git


Ignore:
Timestamp:
May 26, 2011, 10:29:03 AM (13 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
488808e90a9444d2ce5d16be059643fdd2e8629e
Parents:
e676cdf123bc41ae953d7fd58106263f5fd02d0c
git-author:
Frank Seelisch <seelisch@mathematik.uni-kl.de>2011-05-26 10:29:03+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:36:53+01:00
Message:
made sure that ch is properly set everywhere, and ch >= 0; more ASSUMEs
Location:
libpolys
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    re676cd r73a9ffb  
    217217  unsigned long mod2mMask;
    218218#endif
    219   int        ch;  /* characteristic, rInit
    220                      PLEASE DOCUMENT HERE when this will be negative! */
     219  int        ch;  /* characteristic, set by the local *InitChar methods;
     220                     In field extensions or extensions towers, the
     221                     characteristic can be accessed from any of the
     222                     intermediate extension fields, i.e., in this case
     223                     it is redundant along the chain of field extensions;
     224                     CONTRARY to SINGULAR as it was, we do NOT LONGER use
     225                     negative values for ch. */
    221226
    222227  short      float_len; /* additional char-flags, rInit */
     
    459464  return (r->ringtype == 0) &&
    460465         ((getCoeffType(r)==n_algExt) || (getCoeffType(r)==n_transExt)) &&
    461          (r->ch < -1);
     466         (r->ch != 0);
    462467}
    463468
     
    469474  return (r->ringtype == 0) &&
    470475         ((getCoeffType(r)==n_algExt) || (getCoeffType(r)==n_transExt)) &&
    471          (r->ch < -1 ) && (-(r->ch) == p);
     476         (r->ch != 0) && (r->ch == p);
    472477}
    473478
  • libpolys/coeffs/ffields.cc

    re676cd r73a9ffb  
    813813  // the variables:
    814814  r->nNULL = (number)0;
    815   assume( r->type == n_GF );
     815  assume( getCoeffType(r) == n_GF );
    816816
    817817  GFInfo* p = (GFInfo *)(parameter);
  • libpolys/coeffs/gnumpc.cc

    re676cd r73a9ffb  
    378378  assume( getCoeffType(n) == ID );
    379379  n->cfKillChar = ndKillChar; /* dummy */
     380  n->ch = 0;
    380381
    381382  n->cfDelete  = ngcDelete;
  • libpolys/coeffs/gnumpfl.cc

    re676cd r73a9ffb  
    385385  assume( getCoeffType(n) == ID );
    386386  n->cfKillChar = ndKillChar; /* dummy */
    387 
     387  n->ch = 0;
     388 
    388389  n->cfDelete  = ngfDelete;
    389390  n->cfNormalize=ndNormalize;
  • libpolys/coeffs/longrat.cc

    re676cd r73a9ffb  
    111111#define MPZ_EXACTDIV(A,B,C) mpz_divexact((A),(B),(C))
    112112
     113/// Our Type!
     114static const n_coeffType ID = n_Q;
     115
    113116void    _nlDelete_NoImm(number *a);
    114 
    115 static const n_coeffType ID = n_long_R;
    116117
    117118/***************************************************************
     
    25452546BOOLEAN nlInitChar(coeffs r, void* p)
    25462547{
    2547   const int ch = (int)(long)(p);
     2548  assume( getCoeffType(r) == ID );
     2549  //const int ch = (int)(long)(p);
    25482550 
    25492551  r->cfKillChar=NULL;
  • libpolys/coeffs/modulop.cc

    re676cd r73a9ffb  
    2323// int npGen=0;
    2424
     25/// Our Type!
     26static const n_coeffType ID = n_Zp;
    2527
    2628BOOLEAN npGreaterZero (number k, const coeffs r)
     
    329331BOOLEAN npInitChar(coeffs r, void* p)
    330332{
     333  assume( getCoeffType(r) == ID );
    331334  const int c = (int) (long) p;
    332335
  • libpolys/coeffs/numbers.cc

    re676cd r73a9ffb  
    7474{
    7575  int c = n_GetChar(r);
     76printf("### c = %d\n", c);
    7677  BOOLEAN ret = n_IsZero(a, r);
    7778  if( (c != 0) && !ret )
  • libpolys/coeffs/rintegers.cc

    re676cd r73a9ffb  
    2222#include "si_gmp.h"
    2323
     24/// Our Type!
     25static const n_coeffType ID = n_Z;
    2426
    2527omBin gmp_nrz_bin = omGetSpecBin(sizeof(mpz_t));
     
    381383BOOLEAN nrzInitChar(coeffs r,  void * parameter)
    382384{
     385  assume( getCoeffType(r) == ID );
    383386  r->cfSetChar= NULL;
    384387  r->nCoeffIsEqual = ndCoeffIsEqual;
     
    425428 
    426429  r->nNULL = 0;
    427   r->type = n_Z;
     430  r->ch = 0;
    428431  r->ringtype = 4;
    429432  r->has_simple_Alloc=FALSE;
  • libpolys/coeffs/rmodulo2m.cc

    re676cd r73a9ffb  
    2424#include <string.h>
    2525
     26/// Our Type!
     27static const n_coeffType ID = n_Z2m;
     28
    2629extern omBin gmp_nrz_bin; /* init in rintegers*/
    2730
     
    4447BOOLEAN nr2mInitChar (coeffs r, void* p)
    4548{
     49  assume( getCoeffType(r) == ID );
    4650  nr2mInitExp((int)(long)(p), r);
    4751  r->cfKillChar    = ndKillChar; /* dummy*/
     
    4953
    5054  r->ringtype = 1;
    51   r->type = n_Z2m;
     55 
     56  /* next cast may yield an overflow as mod2mMask is an unsigned long */
     57  r->ch = (int)r->mod2mMask + 1;
    5258
    5359  r->cfInit        = nr2mInit;
     
    640646  else
    641647  {
    642     /* code unexpectedly called with m = 1; we go on with m = 2: */
     648    /* code unexpectedly called with m = 1; we continue with m = 2: */
    643649    r->mod2mMask = 3; /* i.e., '11' in binary representation */
    644650  }
    645   r->ch = r->mod2mMask + 1;
    646651}
    647652
     
    650655  nr2mSetExp(m, r);
    651656  if (m < 2)
    652     WarnS("nr2mInitExp unexpectedly called with m = 1 (we go on with Z/2^2");
     657    WarnS("nr2mInitExp unexpectedly called with m = 1 (we continue with Z/2^2");
    653658}
    654659
  • libpolys/coeffs/rmodulon.cc

    re676cd r73a9ffb  
    2424#include <string.h>
    2525
     26/// Our Type!
     27static const n_coeffType ID = n_Zn;
     28
    2629extern omBin gmp_nrz_bin;
    2730
     
    4548BOOLEAN nrnInitChar (coeffs r, void* p)
    4649{
    47  
     50  assume( getCoeffType(r) == ID );
    4851  nrnInitExp((int)(long)(p), r);
    4952  r->ringtype = 2;
    50   r->type = n_Zn;
     53 
     54  /* next computation may yield wrong characteristic as r->modNumber
     55     is a GMP number */
     56  r->ch = mpz_get_ui(r->modNumber);
    5157
    5258  r->cfInit        = nrnInit;
  • libpolys/coeffs/shortfl.cc

    re676cd r73a9ffb  
    546546  assume( getCoeffType(n) == ID );
    547547  n->cfKillChar = ndKillChar; /* dummy */
     548  n->ch = 0;
    548549
    549550  n->cfInit = nrInit;
  • libpolys/polys/ext_fields/algext.cc

    re676cd r73a9ffb  
    3737
    3838#include <polys/ext_fields/algext.h>
     39
     40/// our type has been defined as a macro in algext.h
     41/// and is accessible by 'naID'
    3942
    4043/// forward declarations
     
    569572BOOLEAN naInitChar(coeffs cf, void * infoStruct)
    570573{
     574  assume( getCoeffType(cf) == naID );
     575 
    571576  ExtInfo *e = (ExtInfo *)infoStruct;
    572577  /// first check whether cf->algring != NULL and delete old ring???
     
    581586  assume(getCoeffType(cf) == naID);                     // coeff type;
    582587 
    583   cf->ch = -cf->algring->cf->ch;   /* propagate characteristic up so that it
    584                                       becomes directly accessible in cf;
    585                                       negative sign to signal that it's an
    586                                       extension field */
     588  /* propagate characteristic up so that it becomes
     589     directly accessible in cf: */
     590  cf->ch = cf->algring->cf->ch;
    587591 
    588592  #ifdef LDEBUG
Note: See TracChangeset for help on using the changeset viewer.