OmniSciDB  a5dc49c757
 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 475 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 518 of file quantile.h.

518  {
519  return data_[0].centroid_ != centroid;
520  }
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 521 of file quantile.h.

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

521  {
522  return mean_.sum_ * next_centroid->nextCount() !=
523  next_centroid->nextSum() * mean_.count_;
524  }

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

525  {
526  IndexType const idx = index(next_centroid);
527  if (data_[idx].count_skipped_) {
528  ++data_[idx].count_merged_;
529  }
530  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:518
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 531 of file quantile.h.

531  {
532  return data_[0].centroid_;
533  }
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 484 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_.

484  {
485  if (data.count_merged_) {
486  shiftRange(data.centroid_->sums_.begin() + data.start_,
487  data.count_skipped_,
488  data.count_merged_,
489  data.centroid_->inc_);
490  shiftRange(data.centroid_->counts_.begin() + data.start_,
491  data.count_skipped_,
492  data.count_merged_,
493  data.centroid_->inc_);
494  data.start_ += data.centroid_->inc_ * data.count_merged_;
495  }
496  }
static DEVICE void shiftRange(T *const begin, IndexType skipped, IndexType const merged, int const inc)
Definition: quantile.h:498
template<typename RealType , typename IndexType >
DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::shiftCentroidsAndSetNext ( )
inline

Definition at line 535 of file quantile.h.

535  {
536  shiftCentroids(data_[0]);
537  data_[0].centroid_->next_idx_ = data_[0].start_;
538  if (data_[1].centroid_) {
539  shiftCentroids(data_[1]);
540  data_[1].centroid_->next_idx_ = data_[1].start_;
541  }
542  }
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 498 of file quantile.h.

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

501  {
502 #ifdef __CUDACC__
503  T* src = begin + inc * (skipped - 1);
504  T* dst = src + inc * merged;
505  for (; skipped; --skipped, src -= inc, dst -= inc) {
506  *dst = *src;
507  }
508 #else
509  if (inc == 1) {
510  std::copy_backward(begin, begin + skipped, begin + skipped + merged);
511  } else {
512  std::copy(begin + 1 - skipped, begin + 1, begin + 1 - skipped - merged);
513  }
514 #endif
515  }
DEVICE void merged(Centroids< RealType, IndexType > *next_centroid)
Definition: quantile.h:525
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 543 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().

543  {
544  mean_ = Centroid<RealType, IndexType>{next_centroid->nextSum(),
545  next_centroid->nextCount()};
546  data_[0] = {next_centroid, next_centroid->next_idx_, 0, 1};
547  next_centroid->next_idx_ += next_centroid->inc_;
548  }
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 549 of file quantile.h.

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

549  {
550  IndexType const idx = index(next_centroid);
551  if (idx == 1 && data_[1].centroid_ == nullptr) {
552  data_[1] = {next_centroid, next_centroid->next_idx_, 0, 1};
553  } else {
554  if (data_[idx].count_merged_) {
555  shiftCentroids(data_[idx]);
556  data_[idx].count_merged_ = 0;
557  }
558  ++data_[idx].count_skipped_;
559  }
560  next_centroid->next_idx_ += next_centroid->inc_;
561  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:518
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 482 of file quantile.h.


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