Changeset 2995
- Timestamp:
- 07/02/08 08:14:58 (2 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/linbox/linbox/algorithms/rational-reconstruction-base.h
r2994 r2995 492 492 493 493 if (!fastQMaxEEA (ai,bi,ci,di,m,log_m,x,powtwo(powh,log_m+1), log_m+1,queueMax,maxQ)) { 494 cout << "false\n" << flush;494 //cout << "false\n" << flush; 495 495 return false; 496 496 } … … 544 544 QMatrix<Ring> top(_Z); 545 545 if (queueMax.pushpop(top, newQ)) { 546 cout << "1new max " << top.q << "\n" << flush;546 //cout << "1new max " << top.q << "\n" << flush; 547 547 if (maxQ.q < top.q) maxQ = top; 548 548 } 549 cout << "EEA" << qinext << ",";549 //cout << "EEA" << qinext << ","; 550 550 //++i; 551 551 //ainext = ai*qinext + bi; … … 573 573 cur_ainext = r0+1; 574 574 cur_qinext = cur_ainext;//infinity 575 cout << "->1E:" << cur_ri << " " << cur_rinext <<" " << cur_ainext << "\n"<< flush;575 //cout << "->1E:" << cur_ri << " " << cur_rinext <<" " << cur_ainext << "\n"<< flush; 576 576 return true; 577 577 } … … 586 586 cur_ainext = ainext; 587 587 cur_qinext = qinext; 588 cout << "->2E:" << cur_ri << " " << cur_rinext <<" " << cur_ainext << "\n"<< flush;588 //cout << "->2E:" << cur_ri << " " << cur_rinext <<" " << cur_ainext << "\n"<< flush; 589 589 return true; 590 590 } … … 592 592 bool fastQMaxEEA(Element& ai,Element& bi, Element& ci, Element& di, const Element& m, const size_t d, const Element& n, const Element& powh, const size_t& h, myQueue<Ring >& queueMax, QMatrix<Ring>& maxQ) { 593 593 594 cout << m << " " << n << " " << powh << "\n" << flush;594 //cout << m << " " << n << " " << powh << "\n" << flush; 595 595 596 596 ai=Element(1); … … 609 609 QMatrix<Ring> top(_Z); 610 610 if (queueMax.pushpop(top, newQ)) { 611 cout << "2new max " << top.q << "\n"<< flush;611 //cout << "2new max " << top.q << "\n"<< flush; 612 612 if (maxQ.q < top.q) maxQ = top; 613 613 } 614 cout << "m=n1" << ",";614 //cout << "m=n1" << ","; 615 615 return true; 616 616 } … … 618 618 if (powh < 1) return false; //should not happen 619 619 if (n < 2) { 620 cout << "n=1\n"<< flush;620 //cout << "n=1\n"<< flush; 621 621 //n==1 -> Q1=(m,1//1,0) 622 622 //n==0 -> Q1=infinity … … 642 642 if (maxQ.q < top.q) maxQ = top; 643 643 } 644 cout << "n=1" << m << ",";644 //cout << "n=1" << m << ","; 645 645 646 646 return true; … … 650 650 651 651 if (h < 1) { 652 cout << "h < 1" << flush;652 //cout << "h < 1" << flush; 653 653 //quo(qinext,m,n); 654 654 //if (qinext==1) { return (1,1,1,0) or (1,0,0,1) … … 664 664 QMatrix<Ring> top(_Z); 665 665 if (queueMax.pushpop(top, newQ)) { 666 cout << "4new max " << top.q << "\n"<< flush;666 //cout << "4new max " << top.q << "\n"<< flush; 667 667 if (maxQ.q < top.q) maxQ = top; 668 668 } 669 cout << "h=01" << ",";669 //cout << "h=01" << ","; 670 670 671 671 } else { … … 689 689 690 690 if (2*h+1 < d) { 691 cout << "choice1"<< flush;691 //cout << "choice1"<< flush; 692 692 //if (2*h+1 <= log_n) { 693 693 if (true) { 694 cout << ".1\n"<< flush;694 //cout << ".1\n"<< flush; 695 695 size_t lambda = d-2*h-1; 696 696 … … 744 744 } 745 745 746 cout << "\n2 backward steps\n"<< flush;747 cout << "->1:" << cur_ri << " " << cur_rinext <<" " << cur_ainext << "->\n"<< flush;746 //cout << "\n2 backward steps\n"<< flush; 747 //cout << "->1:" << cur_ri << " " << cur_rinext <<" " << cur_ainext << "->\n"<< flush; 748 748 749 749 } 750 750 } else if (h <= d-1) { 751 cout << "choice2\n"<< flush;751 //cout << "choice2\n"<< flush; 752 752 Element a1,a2,b1,b2,c1,c2,d1,d2; 753 753 a1=a2=d1=d2=1; … … 780 780 QMatrix<Ring> top(_Z); 781 781 if (queueMax.pushpop(top, newQ)) { 782 cout << "6new max " << top.q << "\n";782 //cout << "6new max " << top.q << "\n"; 783 783 if (maxQ.q < top.q) maxQ = top; 784 784 } 785 cout << "2step1:" << cur_qinext << ",";785 //cout << "2step1:" << cur_qinext << ","; 786 786 787 787 … … 830 830 //do not add matrix 831 831 ai = a1; bi = b1; ci=c1; di = d1; 832 cout << "End2\n"<< flush;832 //cout << "End2\n"<< flush; 833 833 return 1; 834 834 } … … 859 859 cur_rinext = -cur_rinext; 860 860 } 861 cout << "->2:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "->\n"<< flush;861 //cout << "->2:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "->\n"<< flush; 862 862 if (cur_rinext>0) { 863 863 _Z.quo(cur_qinext,cur_ri,cur_rinext); … … 912 912 QMatrix<Ring > top(_Z); 913 913 if (queueMax.pushpop(top, Q)) { 914 cout << "8new max " << top.q << "\n"<< flush;914 //cout << "8new max " << top.q << "\n"<< flush; 915 915 if (maxQ.q < top.q) maxQ = top; 916 916 } 917 cout << "queue" << Q.q << ",";917 //cout << "queue" << Q.q << ","; 918 918 919 919 //else: queueMax may contain invalid matrices, but if Q.q is max then Q is correct 920 920 } 921 921 } 922 cout << "\n" << K << " backward steps\n"<< flush;923 cout << "->End:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "\n"<< flush;922 //cout << "\n" << K << " backward steps\n"<< flush; 923 //cout << "->End:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "\n"<< flush; 924 924 return 1; 925 925 //} 926 926 927 927 } else {//h=d, h = d+1; 928 cout << "choice3\n"<< flush;928 //cout << "choice3\n"<< flush; 929 929 Element hh = powh; 930 930 size_t log_hh = h; … … 936 936 if (!fastQMaxEEA(ai,bi,ci,di,m,d,n,hh, d-1,queueMax,maxQ)) return 0; 937 937 938 cout << "->3:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "->\n"<< flush;938 //cout << "->3:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "->\n"<< flush; 939 939 } 940 940 … … 950 950 ////rinext = -m*ci + n*ai; 951 951 if (rinext==0) { 952 cout << "\n0 forward steps\n";953 cout << "->End1:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "\n";952 //cout << "\n0 forward steps\n"; 953 //cout << "->End1:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "\n"; 954 954 return 1; 955 955 } … … 981 981 cur_ainext = ainext; 982 982 cur_qinext = qinext; 983 cout << "\n" << K << " forward steps\n"<< flush;984 cout << "->End2:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "\n"<< flush;983 //cout << "\n" << K << " forward steps\n"<< flush; 984 //cout << "->End2:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "\n"<< flush; 985 985 986 986 return 1; … … 992 992 QMatrix<Ring > top(_Z); 993 993 if (queueMax.pushpop(top, Q)) { 994 cout << "9new max " << top.q << "\n"<< flush;994 //cout << "9new max " << top.q << "\n"<< flush; 995 995 if (maxQ.q < top.q) maxQ = top; 996 996 } 997 cout << "End" << qinext << ",";997 //cout << "End" << qinext << ","; 998 998 999 999 … … 1019 1019 cur_ainext = m+1; 1020 1020 cur_qinext = m+1; 1021 cout << "\n" << K << " forward steps\n"<< flush;1022 cout << "->End3:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "\n"<< flush;1021 //cout << "\n" << K << " forward steps\n"<< flush; 1022 //cout << "->End3:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "\n"<< flush; 1023 1023 return 1; 1024 1024 } … … 1083 1083 _Z.divin(q,a); // r0/num 1084 1084 ++C.div_counter; 1085 cout << r0<< " " << a << " " << q << ",";1085 //cout << r0<< " " << a << " " << q << ","; 1086 1086 if (q > qmax) { 1087 1087 //cout << r0<< " " << a << " " << q << ",";
