OmniSciDB  72c90bc290
 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 455 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 498 of file quantile.h.

498  {
499  return data_[0].centroid_ != centroid;
500  }
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 501 of file quantile.h.

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

501  {
502  return mean_.sum_ * next_centroid->nextCount() !=
503  next_centroid->nextSum() * mean_.count_;
504  }

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

505  {
506  IndexType const idx = index(next_centroid);
507  if (data_[idx].count_skipped_) {
508  ++data_[idx].count_merged_;
509  }
510  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:498
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 511 of file quantile.h.

511  {
512  return data_[0].centroid_;
513  }
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 464 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_.

464  {
465  if (data.count_merged_) {
466  shiftRange(data.centroid_->sums_.begin() + data.start_,
467  data.count_skipped_,
468  data.count_merged_,
469  data.centroid_->inc_);
470  shiftRange(data.centroid_->counts_.begin() + data.start_,
471  data.count_skipped_,
472  data.count_merged_,
473  data.centroid_->inc_);
474  data.start_ += data.centroid_->inc_ * data.count_merged_;
475  }
476  }
static DEVICE void shiftRange(T *const begin, IndexType skipped, IndexType const merged, int const inc)
Definition: quantile.h:478
template<typename RealType , typename IndexType >
DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::shiftCentroidsAndSetNext ( )
inline

Definition at line 515 of file quantile.h.

515  {
516  shiftCentroids(data_[0]);
517  data_[0].centroid_->next_idx_ = data_[0].start_;
518  if (data_[1].centroid_) {
519  shiftCentroids(data_[1]);
520  data_[1].centroid_->next_idx_ = data_[1].start_;
521  }
522  }
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 478 of file quantile.h.

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

481  {
482 #ifdef __CUDACC__
483  T* src = begin + inc * (skipped - 1);
484  T* dst = src + inc * merged;
485  for (; skipped; --skipped, src -= inc, dst -= inc) {
486  *dst = *src;
487  }
488 #else
489  if (inc == 1) {
490  std::copy_backward(begin, begin + skipped, begin + skipped + merged);
491  } else {
492  std::copy(begin + 1 - skipped, begin + 1, begin + 1 - skipped - merged);
493  }
494 #endif
495  }
DEVICE void merged(Centroids< RealType, IndexType > *next_centroid)
Definition: quantile.h:505
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 523 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().

523  {
524  mean_ = Centroid<RealType, IndexType>{next_centroid->nextSum(),
525  next_centroid->nextCount()};
526  data_[0] = {next_centroid, next_centroid->next_idx_, 0, 1};
527  next_centroid->next_idx_ += next_centroid->inc_;
528  }
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 529 of file quantile.h.

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

529  {
530  IndexType const idx = index(next_centroid);
531  if (idx == 1 && data_[1].centroid_ == nullptr) {
532  data_[1] = {next_centroid, next_centroid->next_idx_, 0, 1};
533  } else {
534  if (data_[idx].count_merged_) {
535  shiftCentroids(data_[idx]);
536  data_[idx].count_merged_ = 0;
537  }
538  ++data_[idx].count_skipped_;
539  }
540  next_centroid->next_idx_ += next_centroid->inc_;
541  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:498
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 462 of file quantile.h.


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