Go to the documentation of this file.
10 #ifndef vtk_m_worklet_DescriptiveStatistics_h
11 #define vtk_m_worklet_DescriptiveStatistics_h
31 ,
min_(std::numeric_limits<T>::max())
32 ,
max_(std::numeric_limits<T>::lowest())
102 T delta2 = delta * delta;
105 T delta3 = delta * delta2;
106 T n2 = result.
n_ * result.
n_;
108 result.
M3_ += delta3 * x.
n_ * y.
n_ * (x.
n_ - y.
n_) / n2;
109 result.
M3_ += T(3.0) * delta * (x.
n_ * y.
M2_ - y.
n_ * x.
M2_) / result.
n_;
111 T delta4 = delta2 * delta2;
112 T n3 = result.
n_ * n2;
115 result.
M4_ += T(6.0) * delta2 * (x.
n_ * x.
n_ * y.
M2_ + y.
n_ * y.
n_ * x.
M2_) / n2;
116 result.
M4_ += T(4.0) * delta * (x.
n_ * y.
M3_ - y.
n_ * x.
M3_) / result.
n_;
157 return this->
M2_ / (this->
n_ - 1);
163 if (this->
M2_ == 0 || this->
n_ == 0)
167 return this->
M2_ / this->
n_;
173 if (this->
M2_ == 0 || this->
n_ == 0)
185 if (this->
M2_ == 0 || this->
n_ == 0)
191 return this->
n_ * this->
M4_ / (this->
M2_ * this->
M2_);
208 template <
typename T>
224 template <
typename FieldType,
typename Storage>
235 template <
typename KeyType,
typename ValueType,
typename KeyInStorage,
typename ValueInStorage>
251 Algorithm::SortByKey(keys_copy, values_copy);
257 Algorithm::ReduceByKey(keys_copy, states, keys_out, results,
vtkm::Add{});
265 #endif // vtk_m_worklet_DescriptiveStatistics_h
T Kurtosis() const
Definition: DescriptiveStatistics.h:183
StatState(T value)
Definition: DescriptiveStatistics.h:42
Manages an array-worth of data.
Definition: ArrayHandle.h:300
T M3() const
Definition: DescriptiveStatistics.h:139
T Min() const
Definition: DescriptiveStatistics.h:124
T sum_
Definition: DescriptiveStatistics.h:199
StatState()
Definition: DescriptiveStatistics.h:29
T M2() const
Definition: DescriptiveStatistics.h:136
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::Float32 Sqrt(vtkm::Float32 x)
Definition: Math.h:943
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
T M4_
Definition: DescriptiveStatistics.h:203
StatState operator+(const StatState< T > &y) const
Definition: DescriptiveStatistics.h:68
T M4() const
Definition: DescriptiveStatistics.h:142
T Sum() const
Definition: DescriptiveStatistics.h:130
T mean_
Definition: DescriptiveStatistics.h:200
T Mean() const
Definition: DescriptiveStatistics.h:133
T N() const
Definition: DescriptiveStatistics.h:121
T Skewness() const
Definition: DescriptiveStatistics.h:171
T Max() const
Definition: DescriptiveStatistics.h:127
vtkm::cont::ArrayHandleZip< FirstHandleType, SecondHandleType > make_ArrayHandleZip(const FirstHandleType &first, const SecondHandleType &second)
A convenience function for creating an ArrayHandleZip.
Definition: ArrayHandleZip.h:290
Definition: DescriptiveStatistics.h:206
T SampleVariance() const
Definition: DescriptiveStatistics.h:151
ArrayHandleZip is a specialization of ArrayHandle.
Definition: ArrayHandleZip.h:253
StatState(T n, T min, T max, T sum, T mean, T M2, T M3, T M4)
Definition: DescriptiveStatistics.h:55
void ArrayCopy(const SourceArrayType &source, DestArrayType &destination)
Does a deep copy from one array to another array.
Definition: ArrayCopy.h:120
Definition: DescriptiveStatistics.h:26
#define VTKM_CONT
Definition: ExportMacros.h:57
T max_
Definition: DescriptiveStatistics.h:198
T M3_
Definition: DescriptiveStatistics.h:202
Definition: Algorithm.h:386
T n_
Definition: DescriptiveStatistics.h:196
static auto Run(const vtkm::cont::ArrayHandle< KeyType, KeyInStorage > &keys, const vtkm::cont::ArrayHandle< ValueType, ValueInStorage > &values) -> vtkm::cont::ArrayHandleZip< vtkm::cont::ArrayHandle< KeyType >, vtkm::cont::ArrayHandle< StatState< ValueType >>>
Definition: DescriptiveStatistics.h:236
Definition: DescriptiveStatistics.h:22
T PopulationVariance() const
Definition: DescriptiveStatistics.h:161
T min_
Definition: DescriptiveStatistics.h:197
static StatState< FieldType > Run(const vtkm::cont::ArrayHandle< FieldType, Storage > &field)
Calculate various summary statistics for the input ArrayHandle.
Definition: DescriptiveStatistics.h:225
vtkm::cont::ArrayHandleTransform< HandleType, FunctorType > make_ArrayHandleTransform(HandleType handle, FunctorType functor)
make_ArrayHandleTransform is convenience function to generate an ArrayHandleTransform.
Definition: ArrayHandleTransform.h:480
T M2_
Definition: DescriptiveStatistics.h:201
vtkm::worklet::DescriptiveStatistics::StatState< T > operator()(T value) const
Definition: DescriptiveStatistics.h:209
T SampleStddev() const
Definition: DescriptiveStatistics.h:145
T PopulationStddev() const
Definition: DescriptiveStatistics.h:148