Changeset 1f414c8 in git


Ignore:
Timestamp:
Aug 12, 2011, 4:19:06 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
6637ee55dc87d61e2d841f88a872b6f3e2d2e402
Parents:
7fccc79116395e52484b519fc379d165d8cf6bc2
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-12 16:19:06+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:21:28+01:00
Message:
CHG: cleaning up Frank's code for alg./trans. extensions + hiding private details
Location:
libpolys
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/clapsing.cc

    r7fccc79 r1f414c8  
    2525#include "monomials/ring.h"
    2626#include "simpleideals.h"
     27
     28
     29//#include "polys.h"
     30#define TRANSEXT_PRIVATES
    2731#include "ext_fields/transext.h"
    28 //#include "polys.h"
    29 
    30 
    31 TODO(Martin, Please adapt the following code for the use in SW)
     32
     33// TODO(Martin, Please adapt the following code for the use in SW)
    3234
    3335
  • libpolys/polys/ext_fields/algext.cc

    r7fccc79 r1f414c8  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id$ */
    5 /*
    6 * ABSTRACT: numbers in an algebraic extension field K[a] / < f(a) >
    7 *           Assuming that we have a coeffs object cf, then these numbers
    8 *           are polynomials in the polynomial ring K[a] represented by
    9 *           cf->extRing.
    10 *           IMPORTANT ASSUMPTIONS:
    11 *           1.) So far we assume that cf->extRing is a valid polynomial
    12 *               ring in exactly one variable, i.e., K[a], where K is allowed
    13 *               to be any field (representable in SINGULAR and which may
    14 *               itself be some extension field, thus allowing for extension
    15 *               towers).
    16 *           2.) Moreover, this implementation assumes that
    17 *               cf->extRing->minideal is not NULL but an ideal with at
    18 *               least one non-zero generator which may be accessed by
    19 *               cf->extRing->minideal->m[0] and which represents the minimal
    20 *               polynomial f(a) of the extension variable 'a' in K[a].
    21 *           3.) As soon as an std method for polynomial rings becomes
    22 *               availabe, all reduction steps modulo f(a) should be replaced
    23 *               by a call to std. Moreover, in this situation one can finally
    24 *               move from K[a] / < f(a) > to
    25 *                  K[a_1, ..., a_s] / I, with I some zero-dimensional ideal
    26 *                                        in K[a_1, ..., a_s] given by a lex
    27 *                                        Gröbner basis.
    28 *               The code in algext.h and algext.cc is then capable of
    29 *               computing in K[a_1, ..., a_s] / I.
    30 */
     4/**
     5  * ABSTRACT: numbers in an algebraic extension field K[a] / < f(a) >
     6  *           Assuming that we have a coeffs object cf, then these numbers
     7  *           are polynomials in the polynomial ring K[a] represented by
     8  *           cf->extRing.
     9  *           IMPORTANT ASSUMPTIONS:
     10  *           1.) So far we assume that cf->extRing is a valid polynomial
     11  *               ring in exactly one variable, i.e., K[a], where K is allowed
     12  *               to be any field (representable in SINGULAR and which may
     13  *               itself be some extension field, thus allowing for extension
     14  *               towers).
     15  *           2.) Moreover, this implementation assumes that
     16  *               cf->extRing->minideal is not NULL but an ideal with at
     17  *               least one non-zero generator which may be accessed by
     18  *               cf->extRing->minideal->m[0] and which represents the minimal
     19  *               polynomial f(a) of the extension variable 'a' in K[a].
     20  *           3.) As soon as an std method for polynomial rings becomes
     21  *               availabe, all reduction steps modulo f(a) should be replaced
     22  *               by a call to std. Moreover, in this situation one can finally
     23  *               move from K[a] / < f(a) > to
     24  *                  K[a_1, ..., a_s] / I, with I some zero-dimensional ideal
     25  *                                        in K[a_1, ..., a_s] given by a lex
     26  *                                        Gröbner basis.
     27  *               The code in algext.h and algext.cc is then capable of
     28  *               computing in K[a_1, ..., a_s] / I.
     29  **/
    3130
    3231#include "config.h"
     
    4544#include <polys/simpleideals.h>
    4645
    47 #include <polys/ext_fields/algext.h>
    48 
    49 /// our type has been defined as a macro in algext.h
    50 /// and is accessible by 'naID'
     46#include "ext_fields/algext.h"
     47
     48#ifdef LDEBUG
     49#define naTest(a) naDBTest(a,__FILE__,__LINE__,cf)
     50BOOLEAN  naDBTest(number a, const char *f, const int l, const coeffs r);
     51#else
     52#define naTest(a)
     53#endif
     54
     55/// Our own type!
     56static const n_coeffType ID = n_algExt;
     57
     58/* polynomial ring in which our numbers live */
     59#define naRing cf->extRing
     60
     61/* coeffs object in which the coefficients of our numbers live;
     62 * methods attached to naCoeffs may be used to compute with the
     63 * coefficients of our numbers, e.g., use naCoeffs->nAdd to add
     64 * coefficients of our numbers */
     65#define naCoeffs cf->extRing->cf
     66
     67/* minimal polynomial */
     68#define naMinpoly naRing->minideal->m[0]
     69
    5170
    5271/// forward declarations
     
    84103BOOLEAN naDBTest(number a, const char *f, const int l, const coeffs cf)
    85104{
    86   assume(getCoeffType(cf) == naID);
     105  assume(getCoeffType(cf) == ID);
    87106  if (a == NULL) return TRUE;
    88107  p_Test((poly)a, naRing);
     
    415434static BOOLEAN naCoeffIsEqual(const coeffs cf, n_coeffType n, void * param)
    416435{
    417   if (naID != n) return FALSE;
     436  if (ID != n) return FALSE;
    418437  AlgExtInfo *e = (AlgExtInfo *)param;
    419438  /* for extension coefficient fields we expect the underlying
     
    551570{
    552571  /* dst is expected to be an algebraic field extension */
    553   assume(getCoeffType(dst) == naID);
     572  assume(getCoeffType(dst) == ID);
    554573 
    555574  int h = 0; /* the height of the extension tower given by dst */
     
    613632         (cf->extRing->minideal->m[0]    != NULL)    ); // at m[0];
    614633  assume(cf->extRing->cf                 != NULL);      // extRing->cf;
    615   assume(getCoeffType(cf) == naID);                     // coeff type;
     634  assume(getCoeffType(cf) == ID);                     // coeff type;
    616635 
    617636  /* propagate characteristic up so that it becomes
  • libpolys/polys/ext_fields/algext.h

    r7fccc79 r1f414c8  
    3434#include <coeffs/coeffs.h>
    3535
    36 struct ip_sring;
    37 typedef struct ip_sring * ring;
    38 
    39 struct sip_sideal;
    40 typedef struct sip_sideal * ideal;
     36// Forward declarations
     37struct ip_sring; typedef struct ip_sring * ring;
     38struct sip_sideal; typedef struct sip_sideal * ideal;
    4139
    4240/// struct for passing initialization parameters to naInitChar
     
    8179*/
    8280
    83 #ifdef LDEBUG
    84 #define naTest(a) naDBTest(a,__FILE__,__LINE__,cf)
    85 BOOLEAN  naDBTest(number a, const char *f, const int l, const coeffs r);
    86 #else
    87 #define naTest(a)
    88 #endif
    89 
    90 /* our own type */
    91 #define naID n_algExt
    92 
    93 /* polynomial ring in which our numbers live */
    94 #define naRing cf->extRing
    95 
    96 /* coeffs object in which the coefficients of our numbers live;
    97  * methods attached to naCoeffs may be used to compute with the
    98  * coefficients of our numbers, e.g., use naCoeffs->nAdd to add
    99  * coefficients of our numbers */
    100 #define naCoeffs cf->extRing->cf
    101 
    102 /* minimal polynomial */
    103 #define naMinpoly naRing->minideal->m[0]
    10481
    10582#endif
  • libpolys/polys/ext_fields/transext.cc

    r7fccc79 r1f414c8  
    3232*           - if the denominator is a constant - by a polynomial over Q.
    3333*/
     34#define TRANSEXT_PRIVATES
    3435
    3536#include "config.h"
     
    5253#endif
    5354
    54 #include <polys/ext_fields/transext.h>
    55 
    56 /// our type has been defined as a macro in transext.h
    57 /// and is accessible by 'ntID'
     55#include "ext_fields/transext.h"
     56
     57
     58
     59
     60
     61
     62/* constants for controlling the complexity of numbers */
     63#define ADD_COMPLEXITY 1   /**< complexity increase due to + and - */
     64#define MULT_COMPLEXITY 2   /**< complexity increase due to * and / */
     65#define BOUND_COMPLEXITY 10   /**< maximum complexity of a number */
     66
     67/* some useful accessors for fractions: */
     68#define IS0(f) (f == NULL) /**< TRUE iff n represents 0 in K(t_1, .., t_s) */
     69
     70#define DENIS1(f) (f->denominator == NULL) /**< TRUE iff den. represents 1 */
     71#define NUMIS1(f) (p_IsConstant(f->numerator, cf->extRing) && \
     72                   n_IsOne(p_GetCoeff(f->numerator, cf->extRing), \
     73                           cf->extRing->cf))
     74                   /**< TRUE iff num. represents 1 */
     75#define COM(f) f->complexity
     76
     77
     78#ifdef LDEBUG
     79#define ntTest(a) ntDBTest(a,__FILE__,__LINE__,cf)
     80BOOLEAN  ntDBTest(number a, const char *f, const int l, const coeffs r);
     81#else
     82#define ntTest(a)
     83#endif
     84
     85/// Our own type!
     86static const n_coeffType ID = n_transExt;
     87
     88/* polynomial ring in which the numerators and denominators of our
     89   numbers live */
     90#define ntRing cf->extRing
     91
     92/* coeffs object in which the coefficients of our numbers live;
     93 * methods attached to ntCoeffs may be used to compute with the
     94 * coefficients of our numbers, e.g., use ntCoeffs->nAdd to add
     95 * coefficients of our numbers */
     96#define ntCoeffs cf->extRing->cf
     97
     98
    5899
    59100extern omBin fractionObjectBin = omGetSpecBin(sizeof(fractionObject));
     
    98139BOOLEAN ntDBTest(number a, const char *f, const int l, const coeffs cf)
    99140{
    100   assume(getCoeffType(cf) == ntID);
     141  assume(getCoeffType(cf) == ID);
    101142  fraction t = (fraction)a;
    102143  if (IS0(t)) return TRUE;
     
    803844static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param)
    804845{
    805   if (ntID != n) return FALSE;
     846  if (ID != n) return FALSE;
    806847  TransExtInfo *e = (TransExtInfo *)param;
    807848  /* for rational function fields we expect the underlying
     
    9781019{
    9791020  /* dst is expected to be a rational function field */
    980   assume(getCoeffType(dst) == ntID);
     1021  assume(getCoeffType(dst) == ID);
    9811022 
    9821023  int h = 0; /* the height of the extension tower given by dst */
     
    10421083  assume(cf->extRing                != NULL);      // extRing;
    10431084  assume(cf->extRing->cf            != NULL);      // extRing->cf;
    1044   assume(getCoeffType(cf) == ntID);                // coeff type;
     1085  assume(getCoeffType(cf) == ID);                // coeff type;
    10451086 
    10461087  /* propagate characteristic up so that it becomes
  • libpolys/polys/ext_fields/transext.h

    r7fccc79 r1f414c8  
    4040typedef struct ip_sring * ring;
    4141
    42 struct sip_sideal;
    43 typedef struct sip_sideal * ideal;
    4442
    45 struct spolyrec;
    46 typedef struct spolyrec polyrec;
    47 typedef polyrec * poly;
     43// the following is only needed _here_ due to its use in clapsing.cc!
     44#ifdef TRANSEXT_PRIVATES
     45struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec * poly;
    4846
    49 /// struct for passing initialization parameters to naInitChar
    50 typedef struct { ring r; } TransExtInfo;
    5147
    52 /* a number in K(t_1, .., t_s) is represented by either NULL
     48/** a number in K(t_1, .., t_s) is represented by either NULL
    5349   (representing the zero number), or a pointer to a fraction which contains
    5450   the numerator polynomial and the denominator polynomial in K[t_1, .., t_s];
     
    6662   enforced after each arithmetic operation, or such that it will never take
    6763   place.) Moreover, the 'complexity' of n is zero iff the gcd in n (that is,
    68    the gcd of its numerator and denominator) is trivial. */
     64     the gcd of its numerator and denominator) is trivial.
     65 */
    6966struct fractionObject
    7067{
     
    7370  int complexity;
    7471};
     72
    7573typedef struct fractionObject * fraction;
    7674
    77 /* constants for controlling the complexity of numbers */
    78 #define ADD_COMPLEXITY 1   /**< complexity increase due to + and - */
    79 #define MULT_COMPLEXITY 2   /**< complexity increase due to * and / */
    80 #define BOUND_COMPLEXITY 10   /**< maximum complexity of a number */
    8175
    82 /* some useful accessors for fractions: */
    83 #define IS0(f) (f == NULL) /**< TRUE iff n represents 0 in K(t_1, .., t_s) */
    8476#define NUM(f) f->numerator
    8577#define DEN(f) f->denominator
    86 #define DENIS1(f) (f->denominator == NULL) /**< TRUE iff den. represents 1 */
    87 #define NUMIS1(f) (p_IsConstant(f->numerator, cf->extRing) && \
    88                    n_IsOne(p_GetCoeff(f->numerator, cf->extRing), \
    89                            cf->extRing->cf))
    90                    /**< TRUE iff num. represents 1 */
    91 #define COM(f) f->complexity
     78
     79#endif
     80
     81
     82/// struct for passing initialization parameters to naInitChar
     83typedef struct { ring r; } TransExtInfo;
    9284
    9385/// Get a mapping function from src into the domain of this type (n_transExt)
  • libpolys/polys/monomials/p_polys.cc

    r7fccc79 r1f414c8  
    20642064      p=ph;
    20652065      Werror("longalg missing 1");
    2066       #if 0
     2066#if 0
    20672067      while (p!=NULL)
    20682068      { // each monom: coeff in Q_a
     
    21282128      }
    21292129      nlDelete(&h,r->extRing->cf);
    2130       #endif
     2130#endif
    21312131    }
    21322132  }
     
    34043404      qq=p_One(dst);
    34053405      WerrorS("longalg missing 2");
    3406       #if 0
     3406#if 0
    34073407      aq=naPermNumber(pGetCoeff(p),par_perm,OldPar, oldRing);
    34083408      if ((!rMinpolyIsNULL(dst))
    34093409      && ((rField_is_Zp_a(dst)) || (rField_is_Q_a(dst))))
    34103410      {
    3411         p_Normalize(aq,dst);
     3411        p_Normalize(aq,dst);
    34123412        if (aq==NULL)
    3413           p_SetCoeff(qq,n_Init(0,dst->cf),dst);
     3413          p_SetCoeff(qq,n_Init(0,dst->cf),dst);
    34143414      }
    34153415      p_Test(aq,dst);
    3416       #endif
     3416#endif
    34173417    }
    34183418    if (rRing_has_Comp(dst)) p_SetComp(qq, p_GetComp(p,oldRing),dst);
     
    34503450            {
    34513451              WerrorS("longalg missing 3");
    3452               #if 0
     3452#if 0
    34533453              lnumber c=(lnumber)pGetCoeff(qq);
    34543454              if (c->z->next==NULL)
     
    34643464              }
    34653465              mapped_to_par=1;
    3466               #endif
     3466#endif
    34673467            }
    34683468          }
  • libpolys/polys/monomials/ring.h

    r7fccc79 r1f414c8  
    77* ABSTRACT - the interpreter related ring operations
    88*/
    9 /* $Id$ */
    109
    1110/* includes */
  • libpolys/tests/polys_test.h

    r7fccc79 r1f414c8  
    1515#include <coeffs/rintegers.h>
    1616
    17 #include <polys/ext_fields/algext.h>
    18 #include <polys/ext_fields/transext.h>
     17
    1918#include <polys/monomials/ring.h>
    2019#include <polys/monomials/p_polys.h>
     
    2625#include <factory/factory.h>
    2726#endif
     27
     28
     29#define TRANSEXT_PRIVATES
     30
     31#include <polys/ext_fields/algext.h>
     32#include <polys/ext_fields/transext.h>
     33
    2834
    2935class MyGlobalPrintingFixture : public GlobalPrintingFixture
Note: See TracChangeset for help on using the changeset viewer.