Changeset 1f414c8 in git
- Timestamp:
- Aug 12, 2011, 4:19:06 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- 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
- Location:
- libpolys
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/clapsing.cc
r7fccc79 r1f414c8 25 25 #include "monomials/ring.h" 26 26 #include "simpleideals.h" 27 28 29 //#include "polys.h" 30 #define TRANSEXT_PRIVATES 27 31 #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) 32 34 33 35 -
libpolys/polys/ext_fields/algext.cc
r7fccc79 r1f414c8 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 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 **/ 31 30 32 31 #include "config.h" … … 45 44 #include <polys/simpleideals.h> 46 45 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) 50 BOOLEAN 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! 56 static 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 51 70 52 71 /// forward declarations … … 84 103 BOOLEAN naDBTest(number a, const char *f, const int l, const coeffs cf) 85 104 { 86 assume(getCoeffType(cf) == naID);105 assume(getCoeffType(cf) == ID); 87 106 if (a == NULL) return TRUE; 88 107 p_Test((poly)a, naRing); … … 415 434 static BOOLEAN naCoeffIsEqual(const coeffs cf, n_coeffType n, void * param) 416 435 { 417 if ( naID != n) return FALSE;436 if (ID != n) return FALSE; 418 437 AlgExtInfo *e = (AlgExtInfo *)param; 419 438 /* for extension coefficient fields we expect the underlying … … 551 570 { 552 571 /* dst is expected to be an algebraic field extension */ 553 assume(getCoeffType(dst) == naID);572 assume(getCoeffType(dst) == ID); 554 573 555 574 int h = 0; /* the height of the extension tower given by dst */ … … 613 632 (cf->extRing->minideal->m[0] != NULL) ); // at m[0]; 614 633 assume(cf->extRing->cf != NULL); // extRing->cf; 615 assume(getCoeffType(cf) == naID); // coeff type;634 assume(getCoeffType(cf) == ID); // coeff type; 616 635 617 636 /* propagate characteristic up so that it becomes -
libpolys/polys/ext_fields/algext.h
r7fccc79 r1f414c8 34 34 #include <coeffs/coeffs.h> 35 35 36 struct ip_sring; 37 typedef struct ip_sring * ring; 38 39 struct sip_sideal; 40 typedef struct sip_sideal * ideal; 36 // Forward declarations 37 struct ip_sring; typedef struct ip_sring * ring; 38 struct sip_sideal; typedef struct sip_sideal * ideal; 41 39 42 40 /// struct for passing initialization parameters to naInitChar … … 81 79 */ 82 80 83 #ifdef LDEBUG84 #define naTest(a) naDBTest(a,__FILE__,__LINE__,cf)85 BOOLEAN naDBTest(number a, const char *f, const int l, const coeffs r);86 #else87 #define naTest(a)88 #endif89 90 /* our own type */91 #define naID n_algExt92 93 /* polynomial ring in which our numbers live */94 #define naRing cf->extRing95 96 /* coeffs object in which the coefficients of our numbers live;97 * methods attached to naCoeffs may be used to compute with the98 * coefficients of our numbers, e.g., use naCoeffs->nAdd to add99 * coefficients of our numbers */100 #define naCoeffs cf->extRing->cf101 102 /* minimal polynomial */103 #define naMinpoly naRing->minideal->m[0]104 81 105 82 #endif -
libpolys/polys/ext_fields/transext.cc
r7fccc79 r1f414c8 32 32 * - if the denominator is a constant - by a polynomial over Q. 33 33 */ 34 #define TRANSEXT_PRIVATES 34 35 35 36 #include "config.h" … … 52 53 #endif 53 54 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) 80 BOOLEAN 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! 86 static 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 58 99 59 100 extern omBin fractionObjectBin = omGetSpecBin(sizeof(fractionObject)); … … 98 139 BOOLEAN ntDBTest(number a, const char *f, const int l, const coeffs cf) 99 140 { 100 assume(getCoeffType(cf) == ntID);141 assume(getCoeffType(cf) == ID); 101 142 fraction t = (fraction)a; 102 143 if (IS0(t)) return TRUE; … … 803 844 static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param) 804 845 { 805 if ( ntID != n) return FALSE;846 if (ID != n) return FALSE; 806 847 TransExtInfo *e = (TransExtInfo *)param; 807 848 /* for rational function fields we expect the underlying … … 978 1019 { 979 1020 /* dst is expected to be a rational function field */ 980 assume(getCoeffType(dst) == ntID);1021 assume(getCoeffType(dst) == ID); 981 1022 982 1023 int h = 0; /* the height of the extension tower given by dst */ … … 1042 1083 assume(cf->extRing != NULL); // extRing; 1043 1084 assume(cf->extRing->cf != NULL); // extRing->cf; 1044 assume(getCoeffType(cf) == ntID); // coeff type;1085 assume(getCoeffType(cf) == ID); // coeff type; 1045 1086 1046 1087 /* propagate characteristic up so that it becomes -
libpolys/polys/ext_fields/transext.h
r7fccc79 r1f414c8 40 40 typedef struct ip_sring * ring; 41 41 42 struct sip_sideal;43 typedef struct sip_sideal * ideal;44 42 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 45 struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec * poly; 48 46 49 /// struct for passing initialization parameters to naInitChar50 typedef struct { ring r; } TransExtInfo;51 47 52 /* a number in K(t_1, .., t_s) is represented by either NULL48 /** a number in K(t_1, .., t_s) is represented by either NULL 53 49 (representing the zero number), or a pointer to a fraction which contains 54 50 the numerator polynomial and the denominator polynomial in K[t_1, .., t_s]; … … 66 62 enforced after each arithmetic operation, or such that it will never take 67 63 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 */ 69 66 struct fractionObject 70 67 { … … 73 70 int complexity; 74 71 }; 72 75 73 typedef struct fractionObject * fraction; 76 74 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 */81 75 82 /* some useful accessors for fractions: */83 #define IS0(f) (f == NULL) /**< TRUE iff n represents 0 in K(t_1, .., t_s) */84 76 #define NUM(f) f->numerator 85 77 #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 83 typedef struct { ring r; } TransExtInfo; 92 84 93 85 /// Get a mapping function from src into the domain of this type (n_transExt) -
libpolys/polys/monomials/p_polys.cc
r7fccc79 r1f414c8 2064 2064 p=ph; 2065 2065 Werror("longalg missing 1"); 2066 2066 #if 0 2067 2067 while (p!=NULL) 2068 2068 { // each monom: coeff in Q_a … … 2128 2128 } 2129 2129 nlDelete(&h,r->extRing->cf); 2130 2130 #endif 2131 2131 } 2132 2132 } … … 3404 3404 qq=p_One(dst); 3405 3405 WerrorS("longalg missing 2"); 3406 3406 #if 0 3407 3407 aq=naPermNumber(pGetCoeff(p),par_perm,OldPar, oldRing); 3408 3408 if ((!rMinpolyIsNULL(dst)) 3409 3409 && ((rField_is_Zp_a(dst)) || (rField_is_Q_a(dst)))) 3410 3410 { 3411 3411 p_Normalize(aq,dst); 3412 3412 if (aq==NULL) 3413 3413 p_SetCoeff(qq,n_Init(0,dst->cf),dst); 3414 3414 } 3415 3415 p_Test(aq,dst); 3416 3416 #endif 3417 3417 } 3418 3418 if (rRing_has_Comp(dst)) p_SetComp(qq, p_GetComp(p,oldRing),dst); … … 3450 3450 { 3451 3451 WerrorS("longalg missing 3"); 3452 3452 #if 0 3453 3453 lnumber c=(lnumber)pGetCoeff(qq); 3454 3454 if (c->z->next==NULL) … … 3464 3464 } 3465 3465 mapped_to_par=1; 3466 3466 #endif 3467 3467 } 3468 3468 } -
libpolys/polys/monomials/ring.h
r7fccc79 r1f414c8 7 7 * ABSTRACT - the interpreter related ring operations 8 8 */ 9 /* $Id$ */10 9 11 10 /* includes */ -
libpolys/tests/polys_test.h
r7fccc79 r1f414c8 15 15 #include <coeffs/rintegers.h> 16 16 17 #include <polys/ext_fields/algext.h> 18 #include <polys/ext_fields/transext.h> 17 19 18 #include <polys/monomials/ring.h> 20 19 #include <polys/monomials/p_polys.h> … … 26 25 #include <factory/factory.h> 27 26 #endif 27 28 29 #define TRANSEXT_PRIVATES 30 31 #include <polys/ext_fields/algext.h> 32 #include <polys/ext_fields/transext.h> 33 28 34 29 35 class MyGlobalPrintingFixture : public GlobalPrintingFixture
Note: See TracChangeset
for help on using the changeset viewer.