realroot_doc 0.1.1
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.

    {
      unsigned s = o.size();
      o.resize( s + o.size() );
      for ( sz_t i = 0; i < data.m_res.size(); o[s+i] = data.m_res[i++].t ) ;
    };
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().

    {
      //      std::cout <<"Starting simple solver loop"<<std::endl;
      creal_t * pup, * pdw;
      int d;
      sz_t h,a,s,cup,cdw;
      unsigned_t v;
      s = data.m_s;
      pup = data.m_data;
      data.m_dmn[0].m = 0;
      data.m_dmn[0].e = 0;
      for( a = 0, d = 0; d >= 0; d--, a -= s   ) 
        {
          cup = sgncnt(pup+a,s);
          if ( cup ) 
            {
              if ( isole && cup == 1 ) { data.sstore(d); continue; };
              if ( data.m_dmn[d].e == data.m_limit-1 )
                {
                  if ( cup == 1 ) 
                    {
                      if ( *(pup+a) != 0 )
                        {
                          if ( *(pup+a+s-1) == 0 )
                            data.sstore(d,0);
                          else 
                            data.sstore(d);
                        };
                    }
                  else  
                    {
                      data.mstore(d);
                      //std::cout<<"s "<<cup<<" "<<d<<" "<<data.m_limit<<std::endl;
                    }
                  continue;
                };
              split(pup+a,pup+a+s,s);
              split(data.m_dmn[d],data.m_dmn[d+1]);
              d += 2;
              a += 2*s;
            };
        };
      //std::cout <<"End of simple solver loop"<<std::endl;
    };
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().

    {
      std::cout << "[";
      for ( sz_t i = 0; i < n-1; i ++ )
        std::cout << p[i] << ",";
      std::cout << p[n-1] << " ]";
    };
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.

    {
      sz_t prec = numerics::bitprec(eps);
      data.alloc(in.size(),prec);
      std::copy(in.begin(),in.end(),data.m_data);
      Loop(isole);
    };
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().

    {
      creal_t const * last = b + sz;
      sz_t c;
      int prv = (((*b>0)<<1)|(*b<0));
      int crr;
      for ( c = 0; b != last && c<2; crr = (((*b>0)<<1)|(*b<0)), c += prv != crr, prv = crr, b ++ ) ;
      //      std::cout<<"sgncnt "<< c<<std::endl;
      return c;
    };
static void split ( bound r,
bound l 
) [inline, static]

Definition at line 298 of file solver_binary.hpp.

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

    {
      r.m <<= 1;
      l.m = r.m;
      r.m |=  1;
      r.e ++;
      l.e = r.e;
    };
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().

    {
      creal_t * er, * p;
      er = r + (sz-1);
      for ( er = r + (sz-1); er != r; er--, l++ )
        {
          *l = *r;
          for ( p = r; p != er; p ++ )
            *p = (*p+*(p+1))/2;
        };
      *l = *r;
    };

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.


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