binary_subdivision< K > Struct Template Reference

#include <solver_binary.hpp>

List of all members.

Public Types

Public Member Functions

Static Public Member Functions

Static Public Attributes


Detailed Description

template<class K>
struct mmx::binary_subdivision< K >

Definition at line 256 of file solver_binary.hpp.


Member Typedef Documentation

typedef K::ieee C

Definition at line 261 of file solver_binary.hpp.

typedef C creal_t

Definition at line 269 of file solver_binary.hpp.

typedef K::floating floating

Definition at line 260 of file solver_binary.hpp.

typedef K::integer integer

Definition at line 258 of file solver_binary.hpp.

typedef K::rational rational

Definition at line 259 of file solver_binary.hpp.

typedef unsigned sz_t

Definition at line 263 of file solver_binary.hpp.

typedef bigunsigned<bitquo+(sz_t)(bitrem!=0)> unsigned_t

Definition at line 268 of file solver_binary.hpp.


Member Function Documentation

void get_flags ( output &  o  )  [inline]

Definition at line 363 of file solver_binary.hpp.

References binary_subdivision< K >::data, and data_t::m_res.

00364     {
00365       unsigned s = o.size();
00366       o.resize( s + o.size() );
00367       for ( sz_t i = 0; i < data.m_res.size(); o[s+i] = data.m_res[i++].t ) ;
00368     };

void Loop ( bool  isole = true  )  [inline]

Definition at line 316 of file solver_binary.hpp.

References binary_subdivision< K >::data, bound::e, bound::m, data_t::m_data, data_t::m_dmn, data_t::m_limit, data_t::m_s, data_t::mstore(), binary_subdivision< K >::sgncnt(), binary_subdivision< K >::split(), and data_t::sstore().

Referenced by binary_subdivision< K >::run_loop().

00317     {
00318       //      std::cout <<"Starting simple solver loop"<<std::endl;
00319       creal_t * pup, * pdw;
00320       int d;
00321       sz_t a,s,cup;
00322       unsigned_t v;
00323       s = data.m_s;
00324       pup = data.m_data;
00325       data.m_dmn[0].m = 0;
00326       data.m_dmn[0].e = 0;
00327       for( a = 0, d = 0; d >= 0; d--, a -= s   ) 
00328         {
00329           cup = sgncnt(pup+a,s);
00330           if ( cup ) 
00331             {
00332               if ( isole && cup == 1 ) { data.sstore(d); continue; };
00333               if ( data.m_dmn[d].e == data.m_limit-1 )
00334                 {
00335                   if ( cup == 1 ) 
00336                     {
00337                       if ( *(pup+a) != 0 )
00338                         {
00339                           if ( *(pup+a+s-1) == 0 )
00340                             data.sstore(d,0);
00341                           else 
00342                             data.sstore(d);
00343                         };
00344                     }
00345                   else  
00346                     {
00347                       data.mstore(d);
00348                       //std::cout<<"s "<<cup<<" "<<d<<" "<<data.m_limit<<std::endl;
00349                     }
00350                   continue;
00351                 };
00352               split(pup+a,pup+a+s,s);
00353               split(data.m_dmn[d],data.m_dmn[d+1]);
00354               d += 2;
00355               a += 2*s;
00356             };
00357         };
00358       //std::cout <<"End of simple solver loop"<<std::endl;
00359     };

static void print ( creal_t p,
sz_t  n 
) [inline, static]

Definition at line 308 of file solver_binary.hpp.

Referenced by binary_sleeve_subdivision< K >::writebounds().

00309     {
00310       std::cout << "[";
00311       for ( sz_t i = 0; i < n-1; i ++ )
00312         std::cout << p[i] << ",";
00313       std::cout << p[n-1] << " ]";
00314     };

void run_loop ( const input &  in,
const creal_t eps,
bool  isole,
texp::false_t   
) [inline]

Definition at line 371 of file solver_binary.hpp.

References data_t::alloc(), mmx::numerics::bitprec(), mmx::sparse::copy(), binary_subdivision< K >::data, binary_subdivision< K >::Loop(), and data_t::m_data.

00372     {
00373       sz_t prec = numerics::bitprec(eps);
00374       data.alloc(in.size(),prec);
00375       std::copy(in.begin(),in.end(),data.m_data);
00376       Loop(isole);
00377     };

static sz_t sgncnt ( creal_t const *  b,
sz_t  sz 
) [inline, static]

Definition at line 287 of file solver_binary.hpp.

Referenced by binary_sleeve_subdivision< K >::Loop(), and binary_subdivision< K >::Loop().

00288     {
00289       creal_t const * last = b + sz;
00290       sz_t c;
00291       int prv = (((*b>0)<<1)|(*b<0));
00292       int crr;
00293       for ( c = 0; b != last && c<2; crr = (((*b>0)<<1)|(*b<0)), c += prv != crr, prv = crr, b ++ ) ;
00294       //      std::cout<<"sgncnt "<< c<<std::endl;
00295       return c;
00296     };

static void split ( bound r,
bound l 
) [inline, static]

Definition at line 298 of file solver_binary.hpp.

References bound::e, and bound::m.

00299     {
00300       r.m <<= 1;
00301       l.m = r.m;
00302       r.m |=  1;
00303       r.e ++;
00304       l.e = r.e;
00305     };

static void split ( creal_t r,
creal_t l,
sz_t  sz 
) [inline, static]

Definition at line 274 of file solver_binary.hpp.

Referenced by binary_sleeve_subdivision< K >::dwsplit(), binary_sleeve_subdivision< K >::Loop(), binary_subdivision< K >::Loop(), and binary_sleeve_subdivision< K >::upsplit().

00275     {
00276       creal_t * er, * p;
00277       er = r + (sz-1);
00278       for ( er = r + (sz-1); er != r; er--, l++ )
00279         {
00280           *l = *r;
00281           for ( p = r; p != er; p ++ )
00282             *p = (*p+*(p+1))/2;
00283         };
00284       *l = *r;
00285     };


Member Data Documentation

const sz_t bitquo = numerics::bit_resolution<C>::nbit / numerics::hdwi<sz_t>::nbit [static]

Definition at line 265 of file solver_binary.hpp.

const sz_t bitrem = numerics::bit_resolution<C>::nbit % numerics::hdwi<sz_t>::nbit [static]

Definition at line 266 of file solver_binary.hpp.

data_t data [inline, static]

The documentation for this struct was generated from the following file:

Generated on 6 Dec 2012 for realroot by  doxygen 1.6.1