OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 445 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 488 of file quantile.h.

488  {
489  return data_[0].centroid_ != centroid;
490  }
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 491 of file quantile.h.

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

491  {
492  return mean_.sum_ * next_centroid->nextCount() !=
493  next_centroid->nextSum() * mean_.count_;
494  }

+ 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 495 of file quantile.h.

495  {
496  IndexType const idx = index(next_centroid);
497  if (data_[idx].count_skipped_) {
498  ++data_[idx].count_merged_;
499  }
500  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:488
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 501 of file quantile.h.

501 { 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 454 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_.

454  {
455  if (data.count_merged_) {
456  shiftRange(data.centroid_->sums_.begin() + data.start_,
457  data.count_skipped_,
458  data.count_merged_,
459  data.centroid_->inc_);
460  shiftRange(data.centroid_->counts_.begin() + data.start_,
461  data.count_skipped_,
462  data.count_merged_,
463  data.centroid_->inc_);
464  data.start_ += data.centroid_->inc_ * data.count_merged_;
465  }
466  }
static DEVICE void shiftRange(T *const begin, IndexType skipped, IndexType const merged, int const inc)
Definition: quantile.h:468
template<typename RealType , typename IndexType >
DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::shiftCentroidsAndSetNext ( )
inline

Definition at line 503 of file quantile.h.

503  {
504  shiftCentroids(data_[0]);
505  data_[0].centroid_->next_idx_ = data_[0].start_;
506  if (data_[1].centroid_) {
507  shiftCentroids(data_[1]);
508  data_[1].centroid_->next_idx_ = data_[1].start_;
509  }
510  }
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 468 of file quantile.h.

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

471  {
472 #ifdef __CUDACC__
473  T* src = begin + inc * (skipped - 1);
474  T* dst = src + inc * merged;
475  for (; skipped; --skipped, src -= inc, dst -= inc) {
476  *dst = *src;
477  }
478 #else
479  if (inc == 1) {
480  std::copy_backward(begin, begin + skipped, begin + skipped + merged);
481  } else {
482  std::copy(begin + 1 - skipped, begin + 1, begin + 1 - skipped - merged);
483  }
484 #endif
485  }
DEVICE void merged(Centroids< RealType, IndexType > *next_centroid)
Definition: quantile.h:495
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 511 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().

511  {
512  mean_ = Centroid<RealType, IndexType>{next_centroid->nextSum(),
513  next_centroid->nextCount()};
514  data_[0] = {next_centroid, next_centroid->next_idx_, 0, 1};
515  next_centroid->next_idx_ += next_centroid->inc_;
516  }
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 517 of file quantile.h.

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

517  {
518  IndexType const idx = index(next_centroid);
519  if (idx == 1 && data_[1].centroid_ == nullptr) {
520  data_[1] = {next_centroid, next_centroid->next_idx_, 0, 1};
521  } else {
522  if (data_[idx].count_merged_) {
523  shiftCentroids(data_[idx]);
524  data_[idx].count_merged_ = 0;
525  }
526  ++data_[idx].count_skipped_;
527  }
528  next_centroid->next_idx_ += next_centroid->inc_;
529  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:488
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 452 of file quantile.h.


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