#include <strgy_rdslv_parallel.hpp>
Definition at line 29 of file strgy_rdslv_parallel.hpp.
typedef system::creal_t creal_t |
Definition at line 31 of file strgy_rdslv_parallel.hpp.
typedef system::interval_t interval_t |
Definition at line 32 of file strgy_rdslv_parallel.hpp.
typedef vstack_t::sz_t sz_t |
Definition at line 34 of file strgy_rdslv_parallel.hpp.
typedef system::vstack_t vstack_t |
Definition at line 33 of file strgy_rdslv_parallel.hpp.
Definition at line 54 of file strgy_rdslv_parallel.hpp.
Referenced by parallel< system >::process().
00055 { 00056 sz_t s,i; 00057 for ( s = i = 0; i < 4*this->m_nbp; s += this->pmsz(iptr+i)+this->pMsz(iptr+i), i += 4 ) ; 00058 this->m_cpchnk.dec( s + 2 ); 00059 this->m_ipchnk.dec(4*this->nbp()); 00060 iptr = iptr - 4*this->nbp(); 00061 return iptr; 00062 };
Definition at line 37 of file strgy_rdslv_parallel.hpp.
References assert.
Referenced by parallel< system >::process().
00038 { 00039 assert(iptr%4 == 0); 00040 sz_t i,s; 00041 for ( s = i = 0; i < 4*this->nbp(); s += this->pmsz(iptr+i)+this->pMsz(iptr+i), i += 4 ) ; 00042 s = this->allocc(s+2)+2; 00043 sz_t inext = this->alloci(this->nbp()*4); 00044 for ( i = 0; i < 4*this->nbp(); s += this->pmsz(iptr+i)+this->pMsz(iptr+i), i += 4 ) 00045 { 00046 this->pmsz(inext+i) = this->pmsz(iptr+i); 00047 this->pmad(inext+i) = s; 00048 this->pMad(inext+i) = s + this->pmsz(iptr+i); 00049 this->pMsz(inext+i) = this->pMsz(iptr+i); 00050 }; 00051 return inext; 00052 };
bool process | ( | std::vector< interval_t > & | reductions, | |
const vstack_t & | vp, | |||
const creal_t & | eps = 1e-3 , |
|||
int | k = 12 | |||
) | [inline] |
Definition at line 65 of file strgy_rdslv_parallel.hpp.
References assert, mmx::sparse::copy(), mmx::brnops::decasteljau(), parallel< system >::pdec(), parallel< system >::pinc(), mmx::numerics::rnd_dw(), mmx::numerics::rnd_up(), mmx::realroot::sgn(), and mmx::vctops::sgnchg().
00066 { 00067 this->copy(vp); /* duplication de la pile de projections */ 00068 sz_t iptr, inext, mxsgn, sgn, i, nmult; 00069 int itk = 0; 00070 nmult = iptr = 0; 00071 00072 for ( ; itk >= 0; ) 00073 { 00074 sgn = mxsgn = 0; 00075 00076 /* projections basses */ 00077 for ( mxsgn = i = 0; i < 4*this->nbp(); i += 4 ) 00078 { 00079 if ( this->pmsz(iptr+i) && !(sgn = vctops::sgnchg( this->pmdata(iptr+i),this->pmsz(iptr+i))) ) 00080 { 00081 this->pmsz(iptr+i) = 0; 00082 if ( * this->pmdata(iptr+i) > 0.0 ) break; 00083 }; 00084 if ( mxsgn < sgn ) mxsgn = sgn; 00085 }; 00086 if ( i < 4*this->nbp() ) { iptr = pdec(iptr); itk --; continue; }; 00087 00088 /* projection hautes */ 00089 for ( i = 0; i < 4*this->nbp(); i += 4 ) 00090 { 00091 if ( this->pMsz(iptr+i) && !(sgn = vctops::sgnchg( this->pMdata(iptr+i), this->pMsz(iptr+i))) ) 00092 { 00093 this->pMsz(iptr+i) = 0; 00094 if ( * this->pMdata(iptr+i) < 0.0 ) break; 00095 }; 00096 if ( mxsgn < sgn ) mxsgn = sgn; 00097 }; 00098 if ( i < 4*this->nbp() ) { iptr = pdec(iptr); itk --; continue; }; 00099 00100 /* si le domaine a été accepté, si la précision ou le quota de multiplication est dépassé. */ 00101 if ( !mxsgn || (this->pupper(iptr)-this->plower(iptr)) < eps )/* || nmult > m_ssz * m_esz ) */ 00102 { 00103 if ( reductions.size() == 0 || reductions.back().upper() != this->plower(iptr) ) 00104 reductions.push_back(interval_t(this->plower(iptr),this->pupper(iptr))); 00105 else 00106 reductions.back().define(reductions.back().lower(),this->pupper( iptr )); 00107 iptr = pdec( iptr ); itk --; 00108 continue; 00109 }; 00110 00111 /* incrémentation de la pile */ 00112 inext = pinc(iptr); 00113 00114 // sz_t nbcstl = 0; 00115 /* subdivision des projections basses */ 00116 { 00117 numerics::rounding<creal_t> rnd( numerics::rnd_dw() ); 00118 for ( i = 0; i < 4*this->nbp(); i += 4 ) 00119 if ( this->pmsz(iptr+i) ) 00120 { 00121 nmult += this->pmsz(iptr+i)*(this->pmsz(iptr+i)-1); 00122 brnops::decasteljau(this->pmdata(iptr+i),this->pmdata(inext+i),this->pmsz(iptr+i)); 00123 // nbcstl++; 00124 }; 00125 }; 00126 00127 /* subdivision des projections hautes */ 00128 { 00129 numerics::rounding<creal_t> rnd( numerics::rnd_up() ); 00130 for ( i = 0; i < 4*this->nbp(); i += 4 ) 00131 if ( this->pMsz(iptr+i) ) 00132 { 00133 nmult += this->pMsz(iptr+i)*(this->pMsz(iptr+i)-1); 00134 brnops::decasteljau(this->pMdata(iptr+i),this->pMdata(inext+i),this->pMsz(iptr+i) ); 00135 // nbcstl++; 00136 }; 00137 }; 00138 00139 /* if ( nbcstl == 0 ) 00140 { 00141 print(iptr); 00142 }; */ 00143 00144 // assert(nbcstl); 00145 this->plower(inext) = this->plower(iptr); 00146 this->pupper(inext) = (this->plower(iptr)+this->pupper(iptr))/2; 00147 this->plower(iptr) = this->pupper(inext); 00148 iptr = inext; 00149 itk ++; 00150 }; 00151 00152 return reductions.size() != 0; 00153 assert(k>0); 00154 }