Changeset 8d5f05 in git
- Timestamp:
- Jun 11, 2014, 7:47:46 PM (10 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 38a53c048e362151c5c6f95afd4ff65bb32f577c
- Parents:
- 8ddc7cdebf2fd739ad88aa6464fcf904707cd2f1
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/fast_mult.cc
r8ddc7cd r8d5f05 546 546 number i_number=n_Init(i,r->cf); 547 547 old=new_coef; 548 new_coef=n_IntDiv(new_coef,i_number,r->cf); 548 new_coef=n_Div(new_coef,i_number,r->cf); 549 n_Normalize(new_coef,r->cf); 549 550 n_Delete(&old,r->cf); 550 551 n_Delete(&i_number,r->cf); -
libpolys/coeffs/OPAE.cc
r8ddc7cd r8d5f05 70 70 71 71 72 number nAEIntDiv(number a, number b, const coeffs)73 {74 75 int_poly* f=reinterpret_cast<int_poly*> (a);76 mpz_t* i= reinterpret_cast<mpz_t*> (b);77 int_poly *res=new int_poly;78 res->poly_set(*f);79 res->poly_scalar_div_to(*i);80 return (number) res;81 }82 83 72 number nAEIntMod(number a, number, const coeffs) 84 73 { … … 317 306 r->cfAdd = nAEAdd; 318 307 r->cfDiv = nAEDiv; 319 r->cfIntDiv= nAEIntDiv;320 308 r->cfIntMod= nAEIntMod; 321 309 r->cfExactDiv= nAEExactDiv; -
libpolys/coeffs/OPAE.h
r8ddc7cd r8d5f05 14 14 number nAEAdd (number a, number b, const coeffs r); 15 15 number nAEDiv (number a, number b, const coeffs r); 16 number nAEIntDiv (number a, number b, const coeffs r); //Hir wollte wir was gucken17 16 number nAEIntMod (number a, number b, const coeffs r);// Hir wollte wir was gucken 18 17 number nAEExactDiv (number a, number b, const coeffs r); -
libpolys/coeffs/OPAEQ.cc
r8ddc7cd r8d5f05 72 72 73 73 74 number nAEQIntDiv(number a, number b, const coeffs)75 {76 77 Q_poly* f=reinterpret_cast<Q_poly*> (a);78 mpz_t* i= reinterpret_cast<mpz_t*> (b);79 Q_poly *res=new Q_poly;80 res->Q_poly_set(*f);81 res->Q_poly_scalar_div_to(*i);82 return (number) res;83 }84 85 74 number nAEQIntMod(number a, number, const coeffs) 86 75 { … … 310 299 r->cfAdd = nAEQAdd; 311 300 r->cfDiv = nAEQDiv; 312 r->cfIntDiv= nAEQIntDiv;313 301 r->cfIntMod= nAEQIntMod; 314 302 r->cfExactDiv= nAEQExactDiv; -
libpolys/coeffs/OPAEQ.h
r8ddc7cd r8d5f05 14 14 number nAEQAdd (number a, number b, const coeffs r); 15 15 number nAEQDiv (number a, number b, const coeffs r); 16 number nAEQIntDiv (number a, number b, const coeffs r); //Hir wollte wir was gucken17 16 number nAEQIntMod (number a, number b, const coeffs r);// Hir wollte wir was gucken 18 17 number nAEQExactDiv (number a, number b, const coeffs r); -
libpolys/coeffs/OPAEp.cc
r8ddc7cd r8d5f05 72 72 73 73 74 number nAEpIntDiv(number a, number b, const coeffs)75 {76 77 p_poly* f=reinterpret_cast<p_poly*> (a);78 mpz_t* i= reinterpret_cast<mpz_t*> (b);79 p_poly *res=new p_poly;80 res->p_poly_set(*f);81 res->p_poly_scalar_div_to(*i);82 return (number) res;83 }84 85 74 number nAEpIntMod(number a, number, const coeffs) 86 75 { … … 339 328 r->cfAdd = nAEpAdd; 340 329 r->cfDiv = nAEpDiv; 341 r->cfIntDiv= nAEpIntDiv;342 330 r->cfIntMod= nAEpIntMod; 343 331 r->cfExactDiv= nAEpExactDiv; -
libpolys/coeffs/OPAEp.h
r8ddc7cd r8d5f05 14 14 number nAEpAdd (number a, number b, const coeffs r); 15 15 number nAEpDiv (number a, number b, const coeffs r); 16 number nAEpIntDiv (number a, number b, const coeffs r); //Hir wollte wir was gucken17 16 number nAEpIntMod (number a, number b, const coeffs r);// Hir wollte wir was gucken 18 17 number nAEpExactDiv (number a, number b, const coeffs r); -
libpolys/coeffs/README.coeffs
r8ddc7cd r8d5f05 37 37 -cfKillChar: if additional initializations have to be undone (data, etc) 38 38 -cfSetChar: if additional initializations to use numbers from this coeffs is needed (should not be needed) 39 -cfInt Div, cfIntMod: if the ring has a meaningful Euclidean structure39 -cfIntMod: if the ring has a meaningful Euclidean structure 40 40 -cfGcd, cfExtGcd,cfXExtGcd,cfEucNorm: if the ring (or a subring) has a meaningful Euclidean structure 41 41 -cfAnn: in a principal ideal ring (with zero divisors) -
libpolys/coeffs/coeffs.h
r8ddc7cd r8d5f05 23 23 { 24 24 n_unknown=0, 25 n_Zp, /**< \F{p < ?} */25 n_Zp, /**< \F{p < 2^31} */ 26 26 n_Q, /**< rational (GMP) numbers */ 27 27 n_R, /**< single prescision (6,6) real numbers */ 28 n_GF, /**< \GF{p^n < 32001?} */29 n_long_R, /**< real (GMP) numbers */28 n_GF, /**< \GF{p^n < 2^16} */ 29 n_long_R, /**< real floating point (GMP) numbers */ 30 30 n_algExt, /**< used for all algebraic extensions, i.e., 31 31 the top-most extension in an extension tower … … 34 34 the top-most extension in an extension tower 35 35 is transcendental */ 36 n_long_C, /**< complex (GMP) numbers */36 n_long_C, /**< complex floating point (GMP) numbers */ 37 37 n_Z, /**< only used if HAVE_RINGS is defined: ? */ 38 38 n_Zn, /**< only used if HAVE_RINGS is defined: ? */ … … 140 140 // cfExactDiv does an exact division, but no error checking 141 141 // (I'm not sure I understant and even less that this makes sense) 142 numberfunc cfMult, cfSub ,cfAdd ,cfDiv, cfInt Div, cfIntMod, cfExactDiv;142 numberfunc cfMult, cfSub ,cfAdd ,cfDiv, cfIntMod, cfExactDiv; 143 143 144 144 /// init with an integer … … 619 619 { assume(r != NULL); assume(r->cfDiv!=NULL); return r->cfDiv(a,b,r); } 620 620 621 static inline number n_IntDiv(number a, number b, const coeffs r)622 { assume(r != NULL); assume(r->cfIntDiv!=NULL); return r->cfIntDiv(a,b,r); }623 624 621 /// for r a field, return n_Init(0,r) 625 622 /// otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a -
libpolys/coeffs/ffields.cc
r8ddc7cd r8d5f05 841 841 r->cfAdd = nfAdd; 842 842 r->cfDiv = nfDiv; 843 r->cfIntDiv= nfDiv;844 843 //r->cfIntMod= ndIntMod; 845 844 r->cfExactDiv= nfDiv; -
libpolys/coeffs/gnumpc.cc
r8ddc7cd r8d5f05 530 530 r->cfAdd = nlAdd; 531 531 r->cfDiv = nlDiv; 532 r->cfIntDiv= nlIntDiv;533 532 r->cfIntMod= nlIntMod; 534 533 r->cfExactDiv= nlExactDiv; -
libpolys/coeffs/longrat.cc
r8ddc7cd r8d5f05 85 85 #define MPZ_EXACTDIV(A,B,C) mpz_divexact((A),(B),(C)) 86 86 87 /// Our Type!88 static const n_coeffType ID = n_Q;89 90 87 void _nlDelete_NoImm(number *a); 91 88 … … 120 117 static number nlMapP(number from, const coeffs src, const coeffs dst) 121 118 { 122 assume( getCoeffType(dst) == ID );123 119 assume( getCoeffType(src) == n_Zp ); 124 120 … … 339 335 static number nlMapR(number from, const coeffs src, const coeffs dst) 340 336 { 341 assume( getCoeffType(dst) == ID );342 337 assume( getCoeffType(src) == n_R ); 343 338 … … 370 365 static number nlMapLongR(number from, const coeffs src, const coeffs dst) 371 366 { 372 assume( getCoeffType(dst) == ID );373 367 assume( getCoeffType(src) == n_long_R ); 374 368 … … 1238 1232 number nlModP(number q, const coeffs Q, const coeffs Zp) 1239 1233 { 1240 assume( getCoeffType(Q) == ID );1241 1242 1234 const int p = n_GetChar(Zp); 1243 1235 assume( p > 0 ); … … 1251 1243 { 1252 1244 long i = SR_TO_INT(q); 1253 if (i<0L) 1254 return n_Init( static_cast<int>( P - ((-i)%P) ), Zp); 1255 else 1256 return n_Init( static_cast<int>( i % P ), Zp ); 1245 return n_Init( i, Zp ); 1257 1246 } 1258 1247 … … 1260 1249 1261 1250 // numerator modulo char. should fit into int 1262 number z = n_Init( static_cast< int>(mpz_fdiv_ui(q->z, PP)), Zp );1251 number z = n_Init( static_cast<long>(mpz_fdiv_ui(q->z, PP)), Zp ); 1263 1252 1264 1253 // denominator != 1? … … 1266 1255 { 1267 1256 // denominator modulo char. should fit into int 1268 number n = n_Init( static_cast< int>(mpz_fdiv_ui(q->n, PP)), Zp );1257 number n = n_Init( static_cast<long>(mpz_fdiv_ui(q->n, PP)), Zp ); 1269 1258 1270 1259 number res = n_Div( z, n, Zp ); … … 2110 2099 number nlCopyMap(number a, const coeffs src, const coeffs dst) 2111 2100 { 2112 assume( getCoeffType(dst) == ID );2113 assume( getCoeffType(src) == ID );2114 2101 if ((SR_HDL(a) & SR_INT)||(a==NULL)) 2115 2102 { … … 2121 2108 nMapFunc nlSetMap(const coeffs src, const coeffs dst) 2122 2109 { 2123 assume( getCoeffType(dst) == ID );2124 // assume( getCoeffType(src) == ID );2125 2126 2110 if (nCoeff_is_Q(src)) 2127 2111 { … … 2441 2425 static void nlMPZ(mpz_t m, number &n, const coeffs r) 2442 2426 { 2443 assume( getCoeffType(r) == ID );2444 2445 2427 nlTest(n, r); 2446 2428 nlNormalize(n, r); … … 2661 2643 { 2662 2644 assume(cf != NULL); 2663 assume(getCoeffType(cf) == ID);2664 2645 2665 2646 numberCollectionEnumerator.Reset(); … … 2667 2648 if( !numberCollectionEnumerator.MoveNext() ) // empty zero polynomial? 2668 2649 { 2669 c = n _Init(1, cf);2650 c = nlInit(1, cf); 2670 2651 return; 2671 2652 } … … 2753 2734 { 2754 2735 assume(cf != NULL); 2755 assume(getCoeffType(cf) == ID);2756 2736 2757 2737 numberCollectionEnumerator.Reset(); … … 2759 2739 if( !numberCollectionEnumerator.MoveNext() ) // empty zero polynomial? 2760 2740 { 2761 c = n _Init(1, cf);2741 c = nlInit(1, cf); 2762 2742 // assume( n_GreaterZero(c, cf) ); 2763 2743 return; … … 2840 2820 { 2841 2821 number &n = numberCollectionEnumerator.Current(); 2842 n _InpMult(n, cand, cf);2822 nlInpMult(n, cand, cf); 2843 2823 } 2844 2824 … … 2979 2959 r->is_domain=TRUE; 2980 2960 2981 assume( getCoeffType(r) == ID );2982 2961 //const int ch = (int)(long)(p); 2983 2962 … … 2994 2973 if (p==NULL) r->cfDiv = nlDiv; 2995 2974 else r->cfDiv = nlIntDiv; 2996 r->cfIntDiv= nlIntDiv;2997 2975 r->cfIntMod= nlIntMod; 2998 2976 r->cfExactDiv= nlExactDiv; -
libpolys/coeffs/numbers.cc
r8ddc7cd r8d5f05 382 382 // post init settings: 383 383 if (n->cfRePart==NULL) n->cfRePart=n->cfCopy; 384 if (n->cfIntDiv==NULL) n->cfIntDiv=n->cfDiv;385 384 if (n->cfExactDiv==NULL) n->cfExactDiv=n->cfDiv; 386 385 … … 399 398 assume(n->cfAdd!=NULL); 400 399 assume(n->cfDiv!=NULL); 401 assume(n->cfIntDiv!=NULL);402 400 assume(n->cfIntMod!=NULL); 403 401 assume(n->cfExactDiv!=NULL); -
libpolys/coeffs/rintegers.cc
r8ddc7cd r8d5f05 224 224 } 225 225 226 number nrz IntDiv (number a,number b, const coeffs)226 number nrzExactDiv (number a,number b, const coeffs) 227 227 { 228 228 int_number erg = (int_number) omAllocBin(gmp_nrz_bin); … … 416 416 r->cfAdd = nrzAdd; 417 417 r->cfDiv = nrzDiv; 418 r->cfIntDiv= nrzDiv;419 418 r->cfIntMod= nrzIntMod; 420 r->cfExactDiv= nrz Div;419 r->cfExactDiv= nrzExactDiv; 421 420 r->cfInit = nrzInit; 422 421 r->cfSize = nrzSize; -
libpolys/coeffs/rintegers.h
r8ddc7cd r8d5f05 30 30 number nrzGetUnit (number a, const coeffs r); 31 31 number nrzDiv (number a, number b, const coeffs r); 32 number nrz IntDiv(number a, number b, const coeffs r);32 number nrzExactDiv (number a, number b, const coeffs r); 33 33 number nrzIntMod (number a, number b, const coeffs r); 34 34 number nrzNeg (number c, const coeffs r); -
libpolys/coeffs/rmodulo2m.cc
r8ddc7cd r8d5f05 126 126 r->cfMult = nr2mMult; 127 127 r->cfDiv = nr2mDiv; 128 r->cfIntDiv = nr2mIntDiv;129 128 r->cfAnn = nr2mAnn; 130 129 r->cfIntMod = nr2mMod; -
libpolys/coeffs/rmodulon.cc
r8ddc7cd r8d5f05 133 133 r->cfMult = nrnMult; 134 134 r->cfDiv = nrnDiv; 135 r->cfIntDiv = nrnIntDiv;136 135 r->cfAnn = nrnAnn; 137 136 r->cfIntMod = nrnMod; -
libpolys/polys/coeffrings.h
r8ddc7cd r8d5f05 36 36 static inline number n_Add(number a, number b, const ring r){ return n_Add(a, b, r->cf);} 37 37 static inline number n_Div(number a, number b, const ring r){ return n_Div(a,b, r->cf);} 38 static inline number n_IntDiv(number a, number b, const ring r){ return n_IntDiv(a,b, r->cf);}39 38 static inline number n_ExactDiv(number a, number b, const ring r){ return n_ExactDiv(a,b, r->cf);} 40 39 static inline number n_Gcd(number a, number b, const ring r){ return n_Gcd(a,b, r->cf);} -
libpolys/polys/ext_fields/algext.cc
r8ddc7cd r8d5f05 1474 1474 cf->nCoeffIsEqual = naCoeffIsEqual; 1475 1475 cf->cfInvers = naInvers; 1476 cf->cfIntDiv = naDiv; // ???1477 1476 cf->convFactoryNSingN=naConvFactoryNSingN; 1478 1477 cf->convSingNFactoryN=naConvSingNFactoryN; … … 1520 1519 } 1521 1520 1521 void npolyPower(number a, int exp, number *b, const coeffs cf) 1522 { 1523 naTest(a); 1524 1525 /* special cases first */ 1526 if (a == NULL) 1527 { 1528 if (exp >= 0) *b = NULL; 1529 else WerrorS(nDivBy0); 1530 return; 1531 } 1532 else if (exp == 0) { *b = naInit(1, cf); return; } 1533 else if (exp == 1) { *b = naCopy(a, cf); return; } 1534 else if (exp == -1) { *b = naInvers(a, cf); return; } 1535 1536 int expAbs = exp; if (expAbs < 0) expAbs = -expAbs; 1537 1538 /* now compute a^expAbs */ 1539 poly pow; poly aAsPoly = (poly)a; 1540 if (expAbs <= 7) 1541 { 1542 pow = p_Copy(aAsPoly, naRing); 1543 for (int i = 2; i <= expAbs; i++) 1544 { 1545 pow = p_Mult_q(pow, p_Copy(aAsPoly, naRing), naRing); 1546 } 1547 } 1548 else 1549 { 1550 pow = p_ISet(1, naRing); 1551 poly factor = p_Copy(aAsPoly, naRing); 1552 while (expAbs != 0) 1553 { 1554 if (expAbs & 1) 1555 { 1556 pow = p_Mult_q(pow, p_Copy(factor, naRing), naRing); 1557 } 1558 expAbs = expAbs / 2; 1559 if (expAbs != 0) 1560 { 1561 factor = p_Mult_q(factor, p_Copy(factor, naRing), naRing); 1562 } 1563 } 1564 p_Delete(&factor, naRing); 1565 } 1566 1567 /* invert if original exponent was negative */ 1568 number n = (number)pow; 1569 if (exp < 0) 1570 { 1571 number m = npolyInvers(n, cf); 1572 naDelete(&n, cf); 1573 n = m; 1574 } 1575 *b = n; 1576 } 1577 1522 1578 number npolyDiv(number a, number b, const coeffs cf) 1523 1579 { … … 1549 1605 directly accessible in cf: */ 1550 1606 cf->ch = R->cf->ch; 1607 cf->is_field=FALSE; 1608 cf->is_domain=TRUE; 1551 1609 1552 1610 cf->cfCoeffString = naCoeffString; … … 1595 1653 cf->nCoeffIsEqual = naCoeffIsEqual; 1596 1654 cf->cfInvers = npolyInvers; 1597 cf->cfIntDiv = npolyDiv;1598 1655 cf->convFactoryNSingN=naConvFactoryNSingN; 1599 1656 cf->convSingNFactoryN=naConvSingNFactoryN; -
libpolys/polys/ext_fields/transext.cc
r8ddc7cd r8d5f05 130 130 void ntDelete(number * a, const coeffs cf); 131 131 void ntCoeffWrite(const coeffs cf, BOOLEAN details); 132 number ntIntDiv(number a, number b, const coeffs cf);133 132 const char * ntRead(const char *s, number *a, const coeffs cf); 134 133 static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param); … … 1197 1196 { 1198 1197 c = p_GetCoeff(p, ntRing); 1199 tmp = n _Gcd(c, gcdOfCoefficients, ntCoeffs);1198 tmp = nlGcd(c, gcdOfCoefficients, ntCoeffs); 1200 1199 n_Delete(&gcdOfCoefficients, ntCoeffs); 1201 1200 gcdOfCoefficients = tmp; … … 1206 1205 { 1207 1206 c = p_GetCoeff(p, ntRing); 1208 tmp = n _Gcd(c, gcdOfCoefficients, ntCoeffs);1207 tmp = nlGcd(c, gcdOfCoefficients, ntCoeffs); 1209 1208 n_Delete(&gcdOfCoefficients, ntCoeffs); 1210 1209 gcdOfCoefficients = tmp; … … 2468 2467 cf->nCoeffIsEqual = ntCoeffIsEqual; 2469 2468 cf->cfInvers = ntInvers; 2470 cf->cfIntDiv = ntDiv;2471 2469 cf->cfKillChar = ntKillChar; 2472 2470 -
libpolys/polys/ext_fields/transext.h
r8ddc7cd r8d5f05 127 127 void ntDelete(number * a, const coeffs cf); 128 128 void ntCoeffWrite(const coeffs cf, BOOLEAN details); 129 number ntIntDiv(number a, number b, const coeffs cf);130 129 const char * ntRead(const char *s, number *a, const coeffs cf); 131 130 static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
Note: See TracChangeset
for help on using the changeset viewer.