Changeset 4f9652 in git for libpolys/coeffs/longrat.cc
 Timestamp:
 Aug 2, 2012, 3:33:00 PM (10 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '2234726c50d679d6664181a5c72f75a6fd64a787')
 Children:
 d7ad81d4a58a77b7c782dc91c68ba5aa2a7f148c
 Parents:
 188de86ff46e2712a74ba7395b129a90c6d0b3f5
 gitauthor:
 Hans Schoenemann <hannes@mathematik.unikl.de>20120802 15:33:00+02:00
 gitcommitter:
 Hans Schoenemann <hannes@mathematik.unikl.de>20120802 16:10:41+02:00
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

libpolys/coeffs/longrat.cc
r188de86 r4f9652 2637 2637 } 2638 2638 2639 static void nlClearContent(ICoeffsEnumerator& /*numberCollectionEnumerator*/, number& c, const coeffs cf)2639 static void nlClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs cf) 2640 2640 { 2641 2641 assume(cf != NULL); … … 2643 2643 // all coeffs are given by integers!!! 2644 2644 2645 c = n_Init(1, cf); 2646 assume(FALSE); // TODO: NOT YET IMPLEMENTED!!! 2647 2648 // numberCollectionEnumerator.Reset(); 2649 // 2650 // c = numberCollectionEnumerator.Current(); 2651 // 2652 // n_Normalize(c, r); 2653 // 2654 // if (!n_IsOne(c, r)) 2655 // { 2656 // numberCollectionEnumerator.Current() = n_Init(1, r); // ??? 2657 // 2658 // number inv = n_Invers(c, r); 2659 // 2660 // while( numberCollectionEnumerator.MoveNext() ) 2661 // { 2662 // number &n = numberCollectionEnumerator.Current(); 2663 // n_Normalize(n, r); // ? 2664 // n_InpMult(n, inv, r); 2665 // } 2666 // 2667 // n_Delete(&inv, r); 2668 // } 2645 // part 1, find a small candidate for gcd 2646 number cand1,cand; 2647 int s1,s; 2648 s=2147483647; // max. int 2649 numberCollectionEnumerator.Reset(); 2650 do 2651 { 2652 cand1= numberCollectionEnumerator.Current(); 2653 if (SR_HDL(cand1)&SR_INT) { cand=cand1;break;} 2654 s1=mpz_size1(cand1>z); 2655 if (s>s1) 2656 { 2657 cand=cand1; 2658 s=s1; 2659 } 2660 } while (numberCollectionEnumerator.MoveNext() ); 2661 2662 // part 2: compute gcd(cand,all coeffs) 2663 numberCollectionEnumerator.Reset(); 2664 do 2665 { 2666 nlNormalize(numberCollectionEnumerator.Current(),cf); 2667 cand1= nlGcd(cand,numberCollectionEnumerator.Current(),cf); 2668 nlDelete(&cand,cf); 2669 cand=cand1; 2670 if(nlIsOne(cand,cf)) { c=cand; return; } 2671 } while (numberCollectionEnumerator.MoveNext() ); 2672 2673 // part3: all coeffs = all coeffs / cand 2674 c=cand; 2675 numberCollectionEnumerator.Reset(); 2676 do 2677 { 2678 number t=nlIntDiv(numberCollectionEnumerator.Current(),cand,cf); 2679 nlDelete(&numberCollectionEnumerator.Current(),cf); 2680 numberCollectionEnumerator.Current()=t; 2681 } while (numberCollectionEnumerator.MoveNext() ); 2682 2669 2683 } 2670 2684
Note: See TracChangeset
for help on using the changeset viewer.