39 , totalsz_(arr.totalSize())
40 , arr_(arr.getData()) {
init(); }
45 , arrnd_(0) {
init(); }
51 , arrnd_(0) {
init(); }
57 RangeType getDataRange()
const;
58 int getDefNrBins()
const;
66 DistribRef getDistribution();
80 virtual bool doPrepare(
int);
84 void determineBounds();
85 static void includeInRange(
RangeType&,vT);
114 : extracter_(arr) {
init(taskr); }
117 : extracter_(a,sz) {
init(taskr); }
120 : extracter_(v,sz) {
init(taskr); }
123 : extracter_(ts) {
init(taskr); }
140 template <
class vT>
inline
158 template <
class vT>
inline
163 if (
mIsUdf(rg.start) || val < rg.start )
165 if (
mIsUdf(rg.stop) || val > rg.stop )
170 template <
class vT>
inline
176 const vT* stopptr = arr_ + totalsz_;
177 for (
const vT* cur = arr_; cur != stopptr; cur++ )
178 includeInRange( ret, *cur );
182 for (
int idx=0; idx<totalsz_; idx++ )
183 includeInRange( ret, (*vs_)[idx] );
188 while ( iter.
next() )
189 includeInRange( ret, arrnd_->getND( iter.
getPos() ) );
195 template <
class vT>
inline
198 int ret = (int)(totalsz_ / 132);
211 sd.
step = (rg.stop - rg.start) / nrbins;
217 template <
class vT>
inline
222 if ( !arrnd_ && !arr_ && !vs_ )
223 {
pErrMsg(
"Duh");
return false; }
226 nrbins_ = getDefNrBins();
231 if ( bounds_.start == bounds_.stop )
232 bounds_.stop = bounds_.start + (vT)1;
233 else if ( bounds_.start > bounds_.stop )
234 std::swap( bounds_.start, bounds_.stop );
243 template <
class vT>
inline
248 if (
mIsUdf(bounds_.start) )
249 bounds_.start = rg.start;
250 if (
mIsUdf(bounds_.stop) )
251 bounds_.stop = rg.stop;
254 { bounds_.start = vT(0); bounds_.stop = vT(1); }
258 template <
class vT>
inline
271 template <
class vT>
inline
276 const int nrbins = distrib_->size();
279 for (
od_int64 idx=start; idx<=stop; idx++ )
280 putInBin( arr_[idx], subdistrib, sd, nrbins );
284 for (
od_int64 idx=start; idx<=stop; idx++ )
285 putInBin( (*vs_)[idx], subdistrib, sd, nrbins );
291 while ( iter.
next() )
292 putInBin( arrnd_->getND(iter.
getPos()), subdistrib, sd, nrbins );
295 distrib_->add( subdistrib.arr() );
300 template <
class vT>
inline
303 const int targetnrbins = extracter_.getDefNrBins();
304 extracter_.setNrBins( 32 * targetnrbins );
305 extracter_.setBounds( extracter_.getDataRange() );
314 const vT sumvals = finedistr->sumOfValues();
315 const vT cutoffrelpos = vT(0.0025);
316 const vT locutoff = cutoffrelpos * sumvals;
317 const vT hicutoff = (1-cutoffrelpos) * sumvals;
318 const RangeType posrg( finedistr->positionForCumulative( locutoff ),
319 finedistr->positionForCumulative( hicutoff ) );
322 = extracter_.getSamplingFor( posrg, targetnrbins );
323 distrib_ =
new DistribType( targetsd, targetnrbins );
324 const int finesz = finedistr->size();
327 for (
int idx=0; idx<finesz; idx++ )
329 const int binnr = distrib_->getBinNr( finesd.
atIndex(idx) );
330 distrarr[binnr] += finedistr->get( idx );
332 distrib_->
set( distrarr.arr() );