Changeset bcfd11a in git
- Timestamp:
- Mar 20, 2012, 3:33:34 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- 7e9f1298826e9e80c154aaa465935c0ba2acad38
- Parents:
- dd668fd21e0141dd6716d45d63f34e6ca84d230f
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-03-20 15:33:34+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-03-23 16:06:34+01:00
- Location:
- libpolys/polys/monomials
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/maps.cc
rdd668f rbcfd11a 152 152 omFreeSize((ADDRESS)monoms,l*sizeof(poly)); 153 153 } 154 if (!rMinpolyIsNULL(dst_r)) result=p_MinPolyNormalize(result, dst_r); 154 155 assume(dst_r != NULL); 156 assume(dst_r->cf != NULL); 157 158 if (nCoeff_is_algExt(dst_r->cf)) 159 result = p_MinPolyNormalize(result, dst_r); 155 160 } 156 161 return result; … … 318 323 poly p_MinPolyNormalize(poly p, const ring r) 319 324 { 320 number one = n_Init(1, r->cf); 325 const coeffs C = r->cf; 326 number one = n_Init(1, C); 321 327 spolyrec rp; 322 328 … … 326 332 { 327 333 // this returns 0, if p == MinPoly 328 number product = n_Mult(p GetCoeff(p), one,r->cf);329 if ((product == NULL)||(n_IsZero(product, r->cf)))330 { 331 p_LmDelete(&p, r);334 number product = n_Mult(p_GetCoeff(p, r), one, C); 335 if ((product == NULL)||(n_IsZero(product, C))) 336 { 337 p_LmDelete(&p, r); 332 338 } 333 339 else 334 340 { 335 p_SetCoeff(p, product, r);341 p_SetCoeff(p, product, r); 336 342 pNext(q) = p; 337 343 q = p; … … 340 346 } 341 347 pNext(q) = NULL; 348 n_Delete(&one, C); 342 349 return rp.next; 343 350 } -
libpolys/polys/monomials/p_polys.cc
rdd668f rbcfd11a 3457 3457 poly qq; /* the mapped monomial */ 3458 3458 3459 assume(dst != NULL); 3460 assume(dst->cf != NULL); 3461 3459 3462 while (p != NULL) 3460 3463 { … … 3466 3469 number n = nMap(p_GetCoeff(p, oldRing), oldRing->cf, dst->cf); 3467 3470 3468 if ( (!rMinpolyIsNULL(dst)) && (rField_is_Zp_a(dst) || rField_is_Q_a(dst)) )3471 if ( nCoeff_is_algExt(dst->cf) ) 3469 3472 n_Normalize(n, dst->cf); 3470 3473 … … 3483 3486 p_Test(aq, dst); 3484 3487 3485 if ( (!rMinpolyIsNULL(dst)) && (rField_is_Zp_a(dst) || rField_is_Q_a(dst)) ) 3486 { 3488 if ( nCoeff_is_algExt(dst->cf) ) 3487 3489 p_Normalize(aq,dst); 3488 3489 } 3490 3490 3491 if (aq == NULL) 3491 3492 p_SetCoeff(qq, n_Init(0, dst->cf),dst); // Very dirty trick!!! … … 3586 3587 } 3587 3588 } 3588 if ( mapped_to_par && (!rMinpolyIsNULL(dst)) )3589 if ( mapped_to_par && nCoeff_is_algExt(dst->cf) ) 3589 3590 { 3590 3591 number n = p_GetCoeff(qq, dst); 3591 n_Normalize(n, dst->cf);3592 n_Normalize(n, dst->cf); 3592 3593 p_GetCoeff(qq, dst) = n; 3593 3594 } -
libpolys/polys/monomials/ring.cc
rdd668f rbcfd11a 272 272 else 273 273 n_CoeffWrite(C, details); 274 275 #if 0 276 { 277 PrintS("// characteristic : "); 278 279 char const * const * const params = rParameter(r); 280 281 if (params!=NULL) 282 { 283 Print ("// %d parameter : ",rPar(r)); 284 285 char const * const * sp= params; 286 int nop=0; 287 while (nop<rPar(r)) 288 { 289 PrintS(*sp); 290 PrintS(" "); 291 sp++; nop++; 292 } 293 PrintS("\n// minpoly : "); 294 if ( rField_is_long_C(r) ) 295 { 296 // i^2+1: 297 Print("(%s^2+1)\n", params[0]); 298 } 299 else if (rMinpolyIsNULL(r)) 300 { 301 PrintS("0\n"); 302 } 303 else 304 { 305 StringSetS(""); n_Write(r->cf->minpoly, r); PrintS(StringAppendS("\n")); 306 } 307 //if (r->qideal!=NULL) 308 //{ 309 // iiWriteMatrix((matrix)r->qideal,"// minpolys",1,r,0); 310 // PrintLn(); 311 //} 312 } 313 } 314 #endif 274 // { 275 // PrintS("// characteristic : "); 276 // 277 // char const * const * const params = rParameter(r); 278 // 279 // if (params!=NULL) 280 // { 281 // Print ("// %d parameter : ",rPar(r)); 282 // 283 // char const * const * sp= params; 284 // int nop=0; 285 // while (nop<rPar(r)) 286 // { 287 // PrintS(*sp); 288 // PrintS(" "); 289 // sp++; nop++; 290 // } 291 // PrintS("\n// minpoly : "); 292 // if ( rField_is_long_C(r) ) 293 // { 294 // // i^2+1: 295 // Print("(%s^2+1)\n", params[0]); 296 // } 297 // else if (rMinpolyIsNULL(r)) 298 // { 299 // PrintS("0\n"); 300 // } 301 // else 302 // { 303 // StringSetS(""); n_Write(r->cf->minpoly, r); PrintS(StringAppendS("\n")); 304 // } 305 // //if (r->qideal!=NULL) 306 // //{ 307 // // iiWriteMatrix((matrix)r->qideal,"// minpolys",1,r,0); 308 // // PrintLn(); 309 // //} 310 // } 311 // } 315 312 Print("// number of vars : %d",r->N); 316 313 … … 2131 2128 } 2132 2129 2133 if (!rMinpolyIsNULL(r)) 2130 assume(r != NULL); 2131 assume(r->cf != NULL); 2132 2133 if (nCoeff_is_algExt(r->cf)) 2134 { 2135 assume(r->cf->extRing != NULL); 2136 assume(r->cf->extRing->qideal != NULL); 2134 2137 omCheckAddr(r->cf->extRing->qideal->m[0]); 2138 } 2135 2139 2136 2140 //assume(r->cf!=NULL); … … 5631 5635 5632 5636 5633 BOOLEAN rMinpolyIsNULL(const ring r)5634 {5635 assume(r != NULL);5636 const coeffs C = r->cf;5637 assume(C != NULL);5638 5639 const BOOLEAN ret = nCoeff_is_algExt(C); // || nCoeff_is_GF(C) || nCoeff_is_long_C(C);5640 5641 if( ret )5642 {5643 const ring R = C->extRing;5644 assume( R != NULL );5645 assume( !idIs0(R->qideal) );5646 }5647 5648 // TODO: it should be "!ret" but it'd lead to test fails (due to rDecompose?)5649 return ret;5650 }5651 5652 5637 poly rGetVar(const int varIndex, const ring r) 5653 5638 { -
libpolys/polys/monomials/ring.h
rdd668f rbcfd11a 649 649 650 650 /// Tests whether '(r->cf->minpoly) == NULL' 651 BOOLEAN rMinpolyIsNULL(const ring r); 651 static inline BOOLEAN rMinpolyIsNULL(const ring r) 652 { 653 assume(r != NULL); 654 const coeffs C = r->cf; 655 assume(C != NULL); 656 657 const BOOLEAN ret = nCoeff_is_algExt(C); // || nCoeff_is_GF(C) || nCoeff_is_long_C(C); 658 659 if( ret ) 660 { 661 const ring R = C->extRing; 662 assume( R != NULL ); 663 BOOLEAN idIs0 (ideal h); 664 assume( !idIs0(R->qideal) ); 665 } 666 667 // TODO: this leads to test fails (due to rDecompose?) 668 return !ret; 669 } 670 652 671 653 672
Note: See TracChangeset
for help on using the changeset viewer.