OmniSciDB  16c4e035a1
 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 434 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 477 of file quantile.h.

477  {
478  return data_[0].centroid_ != centroid;
479  }
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 480 of file quantile.h.

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

480  {
481  return mean_.sum_ * next_centroid->nextCount() !=
482  next_centroid->nextSum() * mean_.count_;
483  }

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

484  {
485  IndexType const idx = index(next_centroid);
486  if (data_[idx].count_skipped_) {
487  ++data_[idx].count_merged_;
488  }
489  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:477
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 490 of file quantile.h.

490 { 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 443 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_.

443  {
444  if (data.count_merged_) {
445  shiftRange(data.centroid_->sums_.begin() + data.start_,
446  data.count_skipped_,
447  data.count_merged_,
448  data.centroid_->inc_);
449  shiftRange(data.centroid_->counts_.begin() + data.start_,
450  data.count_skipped_,
451  data.count_merged_,
452  data.centroid_->inc_);
453  data.start_ += data.centroid_->inc_ * data.count_merged_;
454  }
455  }
static DEVICE void shiftRange(T *const begin, IndexType skipped, IndexType const merged, int const inc)
Definition: quantile.h:457
template<typename RealType , typename IndexType >
DEVICE void quantile::detail::anonymous_namespace{quantile.h}::Skipped< RealType, IndexType >::shiftCentroidsAndSetNext ( )
inline

Definition at line 492 of file quantile.h.

492  {
493  shiftCentroids(data_[0]);
494  data_[0].centroid_->next_idx_ = data_[0].start_;
495  if (data_[1].centroid_) {
496  shiftCentroids(data_[1]);
497  data_[1].centroid_->next_idx_ = data_[1].start_;
498  }
499  }
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 457 of file quantile.h.

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

460  {
461 #ifdef __CUDACC__
462  T* src = begin + inc * (skipped - 1);
463  T* dst = src + inc * merged;
464  for (; skipped; --skipped, src -= inc, dst -= inc) {
465  *dst = *src;
466  }
467 #else
468  if (inc == 1) {
469  std::copy_backward(begin, begin + skipped, begin + skipped + merged);
470  } else {
471  std::copy(begin + 1 - skipped, begin + 1, begin + 1 - skipped - merged);
472  }
473 #endif
474  }
DEVICE void merged(Centroids< RealType, IndexType > *next_centroid)
Definition: quantile.h:484
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 500 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().

500  {
501  mean_ = Centroid<RealType, IndexType>{next_centroid->nextSum(),
502  next_centroid->nextCount()};
503  data_[0] = {next_centroid, next_centroid->next_idx_, 0, 1};
504  next_centroid->next_idx_ += next_centroid->inc_;
505  }
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 506 of file quantile.h.

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

506  {
507  IndexType const idx = index(next_centroid);
508  if (idx == 1 && data_[1].centroid_ == nullptr) {
509  data_[1] = {next_centroid, next_centroid->next_idx_, 0, 1};
510  } else {
511  if (data_[idx].count_merged_) {
512  shiftCentroids(data_[idx]);
513  data_[idx].count_merged_ = 0;
514  }
515  ++data_[idx].count_skipped_;
516  }
517  next_centroid->next_idx_ += next_centroid->inc_;
518  }
DEVICE bool index(Centroids< RealType, IndexType > *centroid) const
Definition: quantile.h:477
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 441 of file quantile.h.


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