39 , totalsz_(arr.info().getTotalSz())
40 , arr_(arr.getData()) {
init(); }
45 , arrnd_(0) {
init(); }
51 , arrnd_(0) {
init(); }
57 RangeType getDataRange()
const;
58 int getDefNrBins()
const;
62 void setBounds( RangeType intv ) { bounds_ = intv; }
66 DistribRef getDistribution();
80 virtual bool doPrepare(
int);
84 void determineBounds();
85 static void includeInRange(RangeType&,vT);
114 : extracter_(arr) {
init(tskr); }
117 : extracter_(a,sz) {
init(tskr); }
120 : extracter_(v,sz) {
init(tskr); }
123 : extracter_(ts) {
init(tskr); }
140 template <
class vT>
inline 158 template <
class vT>
inline 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);
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() );
310 const vT sumvals = finedistr->sumOfValues();
311 const vT cutoffrelpos = vT(0.0025);
312 const vT locutoff = cutoffrelpos * sumvals;
313 const vT hicutoff = (1-cutoffrelpos) * sumvals;
314 const RangeType posrg( finedistr->positionForCumulative( locutoff ),
315 finedistr->positionForCumulative( hicutoff ) );
318 = extracter_.getSamplingFor( posrg, targetnrbins );
319 distrib_ =
new DistribType( targetsd, targetnrbins );
320 const int finesz = finedistr->size();
323 for (
int idx=0; idx<finesz; idx++ )
325 const int binnr = distrib_->getBinNr( finesd.
atIndex(idx) );
326 distrarr[binnr] += finedistr->get( idx );
328 distrib_->
set( distrarr.
arr() );
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:285
T step
Definition: samplingdata.h:48
#define od_int64
Definition: plftypes.h:34
static bool execute(TaskRunner *tskr, Task &)
Taskrunner may be zero.
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:64
virtual T * arr()
3rd party access
Definition: typeset.h:86
T atIndex(IT) const
Definition: samplingdata.h:156
Set of (small) copyable elements.
Definition: commontypes.h:26
Class that can execute a task.
Definition: task.h:193
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:270
T start
Definition: samplingdata.h:47
bool setGlobalPos(int64_t)
Definition: arraynd.h:260
DataDistribution< VT > DistribType
Definition: datadistributiontools.h:27
static IdxType getBinNrFor(PosType, const SamplingType &, size_type nrbins)
Definition: datadistribution.h:206
Iterates through all samples in an ArrayND.
Definition: arraynd.h:175
T stop
Definition: ranges.h:91
T start
Definition: ranges.h:90
Sharable data distribution. Sampling defaults to 0 step 1.
Definition: datadistribution.h:42
Holds the fundamental sampling info: start and interval.
Definition: samplingdata.h:20
T * set(T *p, bool doerase=true)
Returns old pointer if not erased.
Definition: ptrman.h:264
#define mClass(module)
Definition: commondefs.h:161
#define pErrMsg(msg)
Usual access point for programmer error messages.
Definition: errmsg.h:34