OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType > Class Template Reference

#include <quantile.h>

+ Collaboration diagram for quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >:

Classes

struct  Data
 

Public Member Functions

DEVICE bool index (Centroids< RealType, IndexType > *centroid) const
 
DEVICE bool isDifferentMean (Centroids< RealType, IndexType > *next_centroid) const
 
DEVICE void merged (Centroids< RealType, IndexType > *next_centroid)
 
DEVICE operator bool () const
 
DEVICE void shiftCentroidsAndSetNext ()
 
DEVICE void skipFirst (Centroids< RealType, IndexType > *next_centroid)
 
DEVICE void skipSubsequent (Centroids< RealType, IndexType > *next_centroid)
 

Static Private Member Functions

static DEVICE void shiftCentroids (Data &data)
 
template<typename T >
static DEVICE void shiftRange (T *const begin, IndexType skipped, IndexType const merged, int const inc)
 

Private Attributes

struct
quantile::detail::anonymous_namespace{quantile.h}::Skipped::Data 
data_ [2]
 
Centroid< RealType, IndexType > mean_
 

Detailed Description

template<typename RealType, typename IndexType>
class quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >

Definition at line 423 of file quantile.h.

Member Function Documentation

template<typename RealType , typename IndexType >
DEVICE bool quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::index ( Centroids< RealType, IndexType > *  centroid) const
inline

Definition at line 466 of file quantile.h.

466  {
467  return data_[0].centroid_ != centroid;
468  }
struct quantile::detail::anonymous_namespace{quantile.h}::Skipped::Data data_[2]
template<typename RealType , typename IndexType >
DEVICE bool quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::isDifferentMean ( Centroids< RealType, IndexType > *  next_centroid) const
inline

Definition at line 469 of file quantile.h.

References quantile::detail::Centroids< RealType, IndexType >::nextCount(), and quantile::detail::Centroids< RealType, IndexType >::nextSum().

469  {
470  return mean_.sum_ * next_centroid->nextCount() !=
471  next_centroid->nextSum() * mean_.count_;
472  }

+ Here is the call graph for this function:

template<typename RealType , typename IndexType >
DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::merged ( Centroids< RealType, IndexType > *  next_centroid)
inline

Definition at line 473 of file quantile.h.

473  {
474  IndexType const idx = index(next_centroid);
475  if (data_[idx].count_skipped_) {
476  ++data_[idx].count_merged_;
477  }
478  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:466
struct quantile::detail::anonymous_namespace{quantile.h}::Skipped::Data data_[2]
template<typename RealType , typename IndexType >
DEVICE quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::operator bool ( ) const
inline

Definition at line 479 of file quantile.h.

479 { return data_[0].centroid_; }
struct quantile::detail::anonymous_namespace{quantile.h}::Skipped::Data data_[2]
template<typename RealType , typename IndexType >
static DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::shiftCentroids ( Data data)
inlinestaticprivate

Definition at line 432 of file quantile.h.

References quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::Data::centroid_, quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::Data::count_merged_, quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::Data::count_skipped_, and quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::Data::start_.

432  {
433  if (data.count_merged_) {
434  shiftRange(data.centroid_->sums_.begin() + data.start_,
435  data.count_skipped_,
436  data.count_merged_,
437  data.centroid_->inc_);
438  shiftRange(data.centroid_->counts_.begin() + data.start_,
439  data.count_skipped_,
440  data.count_merged_,
441  data.centroid_->inc_);
442  data.start_ += data.centroid_->inc_ * data.count_merged_;
443  }
444  }
static DEVICE void shiftRange(T *const begin, IndexType skipped, IndexType const merged, int const inc)
Definition: quantile.h:446
template<typename RealType , typename IndexType >
DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::shiftCentroidsAndSetNext ( )
inline

Definition at line 481 of file quantile.h.

481  {
482  shiftCentroids(data_[0]);
483  data_[0].centroid_->next_idx_ = data_[0].start_;
484  if (data_[1].centroid_) {
485  shiftCentroids(data_[1]);
486  data_[1].centroid_->next_idx_ = data_[1].start_;
487  }
488  }
struct quantile::detail::anonymous_namespace{quantile.h}::Skipped::Data data_[2]
template<typename RealType , typename IndexType >
template<typename T >
static DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::shiftRange ( T *const  begin,
IndexType  skipped,
IndexType const  merged,
int const  inc 
)
inlinestaticprivate

Definition at line 446 of file quantile.h.

References gpu_enabled::copy(), and omnisci.dtypes::T.

449  {
450 #ifdef __CUDACC__
451  T* src = begin + inc * (skipped - 1);
452  T* dst = src + inc * merged;
453  for (; skipped; --skipped, src -= inc, dst -= inc) {
454  *dst = *src;
455  }
456 #else
457  if (inc == 1) {
458  std::copy_backward(begin, begin + skipped, begin + skipped + merged);
459  } else {
460  std::copy(begin + 1 - skipped, begin + 1, begin + 1 - skipped - merged);
461  }
462 #endif
463  }
DEVICE void merged(Centroids< RealType, IndexType > *next_centroid)
Definition: quantile.h:473
DEVICE auto copy(ARGS &&...args)
Definition: gpu_enabled.h:51

+ Here is the call graph for this function:

template<typename RealType , typename IndexType >
DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::skipFirst ( Centroids< RealType, IndexType > *  next_centroid)
inline

Definition at line 489 of file quantile.h.

References quantile::detail::Centroids< RealType, IndexType >::inc_, quantile::detail::Centroids< RealType, IndexType >::next_idx_, quantile::detail::Centroids< RealType, IndexType >::nextCount(), and quantile::detail::Centroids< RealType, IndexType >::nextSum().

489  {
490  mean_ = Centroid<RealType, IndexType>{next_centroid->nextSum(),
491  next_centroid->nextCount()};
492  data_[0] = {next_centroid, next_centroid->next_idx_, 0, 1};
493  next_centroid->next_idx_ += next_centroid->inc_;
494  }
struct quantile::detail::anonymous_namespace{quantile.h}::Skipped::Data data_[2]

+ Here is the call graph for this function:

template<typename RealType , typename IndexType >
DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::skipSubsequent ( Centroids< RealType, IndexType > *  next_centroid)
inline

Definition at line 495 of file quantile.h.

References quantile::detail::Centroids< RealType, IndexType >::inc_, and quantile::detail::Centroids< RealType, IndexType >::next_idx_.

495  {
496  IndexType const idx = index(next_centroid);
497  if (idx == 1 && data_[1].centroid_ == nullptr) {
498  data_[1] = {next_centroid, next_centroid->next_idx_, 0, 1};
499  } else {
500  if (data_[idx].count_merged_) {
501  shiftCentroids(data_[idx]);
502  data_[idx].count_merged_ = 0;
503  }
504  ++data_[idx].count_skipped_;
505  }
506  next_centroid->next_idx_ += next_centroid->inc_;
507  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:466
struct quantile::detail::anonymous_namespace{quantile.h}::Skipped::Data data_[2]

Member Data Documentation

template<typename RealType , typename IndexType >
struct quantile::detail::anonymous_namespace{quantile.h}::Skipped::Data quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::data_[2]
private
template<typename RealType , typename IndexType >
Centroid<RealType, IndexType> quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::mean_
private

Definition at line 430 of file quantile.h.


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