Changeset 49698f3 in git for kernel/mpr_numeric.cc


Ignore:
Timestamp:
Aug 26, 2005, 2:33:27 PM (19 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
695341870a0657f232d330f471725e6277fc18da
Parents:
8cb9f91e38f2b181552eeac6cf64763409e7c918
Message:
*hannes: automatic adjust precision(rootArranger::arrange)


git-svn-id: file:///usr/local/Singular/svn/trunk@8576 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/mpr_numeric.cc

    r8cb9f9 r49698f3  
    33****************************************/
    44
    5 /* $Id: mpr_numeric.cc,v 1.5 2005-08-23 09:11:08 Singular Exp $ */
     5/* $Id: mpr_numeric.cc,v 1.6 2005-08-26 12:33:27 Singular Exp $ */
    66
    77/*
     
    896896  bool found;
    897897  //gmp_complex mprec(1.0/pow(10,gmp_output_digits-5),1.0/pow(10,gmp_output_digits-5));
    898   gmp_float mprec(1.0/pow(10.0,(int)(gmp_output_digits/3)));
    899898
    900899  for ( xkoord= 0; xkoord < anzm; xkoord++ ) {    // für x1,x2, x1,x2,x3, x1,x2,...,xn
     900    gmp_float mprec(1.0/pow(10.0,(int)(gmp_output_digits/3)));
    901901    for ( r= 0; r < anzr; r++ ) {                 // für jede Nullstelle
    902902      // (x1-koordinate) * evp[1] + (x2-koordinate) * evp[2] +
     
    908908      }
    909909      found= false;
    910       for ( rtest= r; rtest < anzr; rtest++ ) {   // für jede Nullstelle
    911         zwerg = tmp - (*roots[xk])[rtest] * mu[xkoord]->evPointCoord(xk+1); // xk+1, xkoord+2
    912         for ( mtest= 0; mtest < anzr; mtest++ )
     910      do { // while not found
     911        for ( rtest= r; rtest < anzr; rtest++ ) {   // für jede Nullstelle
     912           zwerg = tmp - (*roots[xk])[rtest] * mu[xkoord]->evPointCoord(xk+1); // xk+1, xkoord+2
     913          for ( mtest= 0; mtest < anzr; mtest++ )
     914          {
     915            //          if ( tmp == (*mu[xkoord])[mtest] )
     916            //          {
     917            if ( ((zwerg.real() <= (*mu[xkoord])[mtest].real() + mprec) &&
     918                  (zwerg.real() >= (*mu[xkoord])[mtest].real() - mprec)) &&
     919                 ((zwerg.imag() <= (*mu[xkoord])[mtest].imag() + mprec) &&
     920                  (zwerg.imag() >= (*mu[xkoord])[mtest].imag() - mprec)) )
     921            {
     922              roots[xk]->swapRoots( r, rtest );
     923              found= true;
     924              break;
     925            }
     926          }
     927        } // rtest
     928        if (!found)
    913929        {
    914           //          if ( tmp == (*mu[xkoord])[mtest] )
    915           //          {
    916           if ( ((zwerg.real() <= (*mu[xkoord])[mtest].real() + mprec) &&
    917                 (zwerg.real() >= (*mu[xkoord])[mtest].real() - mprec)) &&
    918                ((zwerg.imag() <= (*mu[xkoord])[mtest].imag() + mprec) &&
    919                 (zwerg.imag() >= (*mu[xkoord])[mtest].imag() - mprec)) )
    920            {
    921              roots[xk]->swapRoots( r, rtest );
    922              found= true;
    923              break;
    924            }
    925         }
    926       } // rtest
     930          WarnS("rootArranger::arrange: precision lost");
     931          mprec*=10;
     932        }
     933      } while(!found);
     934#if 0
    927935      if ( !found )
    928936      {
    929937        Warn("rootArranger::arrange: No match? coord %d, root %d.",xkoord,r);
    930 #ifdef mprDEBUG_PROT
     938//#ifdef mprDEBUG_PROT
    931939        WarnS("One of these ...");
    932940        for ( rtest= r; rtest < anzr; rtest++ )
     
    945953          Warn("                  %s",complexToStr((*mu[xkoord])[mtest],gmp_output_digits+1));
    946954        }
    947 #endif
    948       }
     955//#endif
     956      }
     957#endif     
    949958    } // r
    950959  } // xkoord
Note: See TracChangeset for help on using the changeset viewer.