Changeset 39d731 in git
- Timestamp:
- Aug 10, 2012, 5:52:11 PM (11 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 285a39387fec8e81c98db529fa68b87b73a65cd6
- Parents:
- 73260639099e75033ef78f48ad34a0ee10e1c15e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/coeffs/longrat.cc
r7326063 r39d731 2653 2653 s=2147483647; // max. int 2654 2654 numberCollectionEnumerator.Reset(); 2655 int lc_is_pos=nlGreaterZero(numberCollectionEnumerator.Current(),cf); 2655 2656 do 2656 2657 { 2657 2658 cand1= numberCollectionEnumerator.Current(); 2658 2659 if (SR_HDL(cand1)&SR_INT) { cand=cand1;break;} 2660 assume(cand1->s==3); // all coeffs should be integers 2659 2661 s1=mpz_size1(cand1->z); 2660 2662 if (s>s1) … … 2671 2673 { 2672 2674 nlNormalize(numberCollectionEnumerator.Current(),cf); 2673 cand1= nlGcd(cand,numberCollectionEnumerator.Current(),cf); 2674 nlDelete(&cand,cf); 2675 nlInpGcd(cand,numberCollectionEnumerator.Current(),cf); 2675 2676 cand=cand1; 2676 if(nlIsOne(cand,cf)) { c=cand; return; } 2677 if(nlIsOne(cand,cf)) 2678 { 2679 c=cand; 2680 if(!lc_is_pos) 2681 { 2682 // make the leading coeff positive 2683 c=nlNeg(c,cf); 2684 numberCollectionEnumerator.Reset(); 2685 do 2686 { 2687 numberCollectionEnumerator.Current()=nlNeg(numberCollectionEnumerator.Current(),cf); 2688 } while (numberCollectionEnumerator.MoveNext() ); 2689 } 2690 return; 2691 } 2677 2692 } while (numberCollectionEnumerator.MoveNext() ); 2678 2693 2679 2694 // part3: all coeffs = all coeffs / cand 2695 if (!lc_is_pos) cand=nlNeg(cand,cf); 2680 2696 c=cand; 2681 2697 numberCollectionEnumerator.Reset(); … … 2707 2723 mpz_init(tmp); 2708 2724 numberCollectionEnumerator.Reset(); 2725 int lc_is_pos=nlGreaterZero(numberCollectionEnumerator.Current(),cf); 2709 2726 do 2710 2727 { … … 2739 2756 mpz_clear(tmp); 2740 2757 FREE_RNUMBER(cand); 2741 c=nlInit(1,cf); 2758 if (lc_is_pos) 2759 c=nlInit(1,cf); 2760 else 2761 { 2762 // make the leading coeff positive 2763 c=nlInit(-1,cf); 2764 numberCollectionEnumerator.Reset(); 2765 do 2766 { 2767 numberCollectionEnumerator.Current()=nlNeg(numberCollectionEnumerator.Current(),cf); 2768 } while (numberCollectionEnumerator.MoveNext() ); 2769 } 2742 2770 return; 2743 2771 }
Note: See TracChangeset
for help on using the changeset viewer.