Show
Ignore:
Timestamp:
07/02/08 08:14:58 (5 months ago)
Author:
aniau
Message:

=

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/linbox/linbox/algorithms/rational-reconstruction-base.h

    r2994 r2995  
    492492                 
    493493                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; 
    495495                        return false; 
    496496                } 
     
    544544                        QMatrix<Ring> top(_Z); 
    545545                        if (queueMax.pushpop(top, newQ)) { 
    546                                 cout << "1new max " << top.q << "\n" << flush; 
     546                                //cout << "1new max " << top.q << "\n" << flush; 
    547547                                if (maxQ.q < top.q) maxQ = top; 
    548548                        } 
    549                         cout << "EEA" << qinext << ","; 
     549                        //cout << "EEA" << qinext << ","; 
    550550                        //++i; 
    551551                        //ainext = ai*qinext + bi; 
     
    573573                                cur_ainext = r0+1; 
    574574                                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; 
    576576                                return true; 
    577577                        } 
     
    586586                cur_ainext = ainext; 
    587587                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; 
    589589                return true; 
    590590        } 
     
    592592        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) { 
    593593                 
    594                 cout << m << " " << n << " " << powh << "\n" << flush; 
     594                //cout << m << " " << n << " " << powh << "\n" << flush; 
    595595                 
    596596                ai=Element(1); 
     
    609609                        QMatrix<Ring> top(_Z); 
    610610                        if (queueMax.pushpop(top, newQ)) { 
    611                                 cout << "2new max " << top.q << "\n"<< flush; 
     611                                //cout << "2new max " << top.q << "\n"<< flush; 
    612612                                if (maxQ.q < top.q) maxQ = top; 
    613613                        } 
    614                         cout << "m=n1" << ","; 
     614                        //cout << "m=n1" << ","; 
    615615                        return true; 
    616616                } 
     
    618618                if (powh < 1) return false; //should not happen 
    619619                if (n < 2) { 
    620                         cout << "n=1\n"<< flush; 
     620                        //cout << "n=1\n"<< flush; 
    621621                                         //n==1 -> Q1=(m,1//1,0) 
    622622                                         //n==0 -> Q1=infinity 
     
    642642                                        if (maxQ.q < top.q) maxQ = top; 
    643643                                } 
    644                                 cout << "n=1" << m << ","; 
     644                                //cout << "n=1" << m << ","; 
    645645                                 
    646646                                return true; 
     
    650650 
    651651                if (h < 1) { 
    652                         cout << "h < 1" << flush; 
     652                        //cout << "h < 1" << flush; 
    653653                        //quo(qinext,m,n);  
    654654                        //if (qinext==1) { return (1,1,1,0) or (1,0,0,1) 
     
    664664                                QMatrix<Ring> top(_Z); 
    665665                                if (queueMax.pushpop(top, newQ)) { 
    666                                         cout << "4new max " << top.q << "\n"<< flush; 
     666                                        //cout << "4new max " << top.q << "\n"<< flush; 
    667667                                        if (maxQ.q < top.q) maxQ = top; 
    668668                                } 
    669                                 cout << "h=01" << ","; 
     669                                //cout << "h=01" << ","; 
    670670 
    671671                        } else { 
     
    689689 
    690690                if (2*h+1 < d) { 
    691                         cout << "choice1"<< flush; 
     691                        //cout << "choice1"<< flush; 
    692692                        //if (2*h+1 <= log_n) { 
    693693                  if (true) {    
    694                         cout << ".1\n"<< flush; 
     694                        //cout << ".1\n"<< flush; 
    695695                        size_t lambda = d-2*h-1; 
    696696 
     
    744744                        } 
    745745 
    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; 
    748748 
    749749                   } 
    750750                } else if (h <= d-1) { 
    751                         cout << "choice2\n"<< flush; 
     751                        //cout << "choice2\n"<< flush; 
    752752                        Element a1,a2,b1,b2,c1,c2,d1,d2; 
    753753                        a1=a2=d1=d2=1; 
     
    780780                                QMatrix<Ring> top(_Z); 
    781781                                if (queueMax.pushpop(top, newQ)) { 
    782                                         cout << "6new max " << top.q << "\n"; 
     782                                        //cout << "6new max " << top.q << "\n"; 
    783783                                        if (maxQ.q < top.q) maxQ = top; 
    784784                                } 
    785                                 cout << "2step1:" << cur_qinext << ","; 
     785                                //cout << "2step1:" << cur_qinext << ","; 
    786786 
    787787 
     
    830830                                //do not add matrix 
    831831                                ai = a1; bi = b1; ci=c1; di = d1; 
    832                                 cout << "End2\n"<< flush; 
     832                                //cout << "End2\n"<< flush; 
    833833                                return 1; 
    834834                        } 
     
    859859                                cur_rinext = -cur_rinext; 
    860860                        } 
    861                         cout << "->2:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "->\n"<< flush; 
     861                        //cout << "->2:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "->\n"<< flush; 
    862862                        if (cur_rinext>0) { 
    863863                                _Z.quo(cur_qinext,cur_ri,cur_rinext); 
     
    912912                                        QMatrix<Ring > top(_Z); 
    913913                                        if (queueMax.pushpop(top, Q)) { 
    914                                                 cout << "8new max " << top.q << "\n"<< flush; 
     914                                                //cout << "8new max " << top.q << "\n"<< flush; 
    915915                                                if (maxQ.q < top.q) maxQ = top; 
    916916                                        } 
    917                                         cout << "queue" << Q.q << ","; 
     917                                        //cout << "queue" << Q.q << ","; 
    918918 
    919919                                        //else: queueMax may contain invalid matrices, but if Q.q is max then Q is correct 
    920920                                } 
    921921                        } 
    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; 
    924924                        return 1; 
    925925                        //}                                
    926926 
    927927                } else {//h=d, h = d+1; 
    928                         cout << "choice3\n"<< flush; 
     928                        //cout << "choice3\n"<< flush; 
    929929                        Element hh = powh; 
    930930                        size_t log_hh = h; 
     
    936936                        if (!fastQMaxEEA(ai,bi,ci,di,m,d,n,hh, d-1,queueMax,maxQ)) return 0; 
    937937 
    938                                 cout << "->3:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "->\n"<< flush; 
     938                                //cout << "->3:" << cur_ri << " " << cur_rinext << " " << cur_ainext << "->\n"<< flush; 
    939939                } 
    940940                 
     
    950950                ////rinext = -m*ci + n*ai; 
    951951                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"; 
    954954                        return 1; 
    955955                } 
     
    981981                                cur_ainext = ainext; 
    982982                                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; 
    985985 
    986986                                return 1; 
     
    992992                                QMatrix<Ring > top(_Z); 
    993993                                if (queueMax.pushpop(top, Q)) { 
    994                                         cout << "9new max " << top.q << "\n"<< flush; 
     994                                        //cout << "9new max " << top.q << "\n"<< flush; 
    995995                                        if (maxQ.q < top.q) maxQ = top; 
    996996                                } 
    997                                 cout << "End" << qinext << ","; 
     997                                //cout << "End" << qinext << ","; 
    998998 
    999999 
     
    10191019                                        cur_ainext = m+1; 
    10201020                                        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; 
    10231023                                        return 1; 
    10241024                                } 
     
    10831083                    _Z.divin(q,a);        // r0/num 
    10841084++C.div_counter; 
    1085                         cout << r0<< " " << a << " " <<  q << ","; 
     1085                        //cout << r0<< " " << a << " " <<  q << ","; 
    10861086                    if (q > qmax) { 
    10871087                            //cout << r0<< " " << a << " " <<  q << ",";