UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SampleSetStatistics.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "BoxTypes.h"
6
7namespace UE
8{
9namespace Geometry
10{
11
12
17template<typename RealType>
19{
22
25
27 RealType Mean = 0;
28
30 RealType StandardDeviation = 0;
31
32
33
34 //
35 // two-pass construction for a sample set with known size.
36 //
37 // Usage:
38 // FFixedCountData Data = Stat.Begin_FixedCount(N);
39 // for ( Value in Values )
40 // Stat.AccumulateValue_FixedCount(Value);
41 // Stat.StartSecondPass_FixedCount(Data);
42 // for ( Value in Values )
43 // Stat.AccumulateValue_FixedCount(Value);
44 // Stat.CompleteSecondPass_FixedCount(Data);
45
46
48 {
50 RealType CountDivide;
51 };
52
54 {
55 Count = CountIn;
57 Mean = 0;
59
60 FFixedCountData Data;
61 Data.CountDivide = 1.0 / (RealType)Count;
62 Data.PassNum = 0;
63 return Data;
64 }
65
67 {
69 DataInOut.CountDivide = 1.0 / (RealType)(Count - 1);
70 DataInOut.PassNum = 1;
71 }
72
77
79 {
80 if (DataInOut.PassNum == 0)
81 {
82 Range.Contain(Value);
83 Mean += Value * DataInOut.CountDivide;
84 }
85 else
86 {
87 StandardDeviation += (Value - Mean) * (Value - Mean) * DataInOut.CountDivide;
88 }
89 }
90
91};
92
95
96
101template<typename RealType>
103{
107
108
115
117
119 {
120 for (int32 j = 0; j < NumStatistics; ++j)
121 {
122 FixedCountBuildData[j] = Statistics[j].Begin_FixedCount(Count);
123 }
124 }
125
127 {
128 for (int32 j = 0; j < NumStatistics; ++j)
129 {
130 Statistics[j].StartSecondPass_FixedCount(FixedCountBuildData[j]);
131 }
132 }
133
135 {
136 for (int32 j = 0; j < NumStatistics; ++j)
137 {
138 Statistics[j].CompleteSecondPass_FixedCount(FixedCountBuildData[j]);
139 }
140 }
141
143 {
145 }
146
147
148 template<typename EnumerableType>
150 {
151 check(NumStatistics == 1);
153 for (RealType Value : MultiEnumerableType)
154 {
155 Statistics[0].AccumulateValue_FixedCount(Value, FixedCountBuildData[0]);
156 }
158 for (RealType Value : MultiEnumerableType)
159 {
160 Statistics[0].AccumulateValue_FixedCount(Value, FixedCountBuildData[0]);
161 }
163 }
164
165};
166
167
168} // end namespace UE::Geometry
169} // end namespace UE
#define check(expr)
Definition AssertionMacros.h:314
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Array.h:670
static RealType Sqrt(const RealType Value)
Definition MathUtil.h:342
TSampleSetStatistics< double > FSampleSetStatisticsd
Definition SampleSetStatistics.h:94
TSampleSetStatistics< float > FSampleSetStatisticsf
Definition SampleSetStatistics.h:93
Definition AdvancedWidgetsModule.cpp:13
U16 Index
Definition radfft.cpp:71
Definition BoxTypes.h:19
static TInterval1< RealType > Empty()
Definition BoxTypes.h:34
Definition SampleSetStatistics.h:103
void StartSecondPass_FixedCount()
Definition SampleSetStatistics.h:126
int32 NumStatistics
Definition SampleSetStatistics.h:104
TArray< typename TSampleSetStatistics< RealType >::FFixedCountData > FixedCountBuildData
Definition SampleSetStatistics.h:106
void ComputeMultiPass(int64 Count, const EnumerableType &MultiEnumerableType)
Definition SampleSetStatistics.h:149
TArray< TSampleSetStatistics< RealType > > Statistics
Definition SampleSetStatistics.h:105
const TSampleSetStatistics< RealType > & operator[](int32 Index) const
Definition SampleSetStatistics.h:116
void Begin_FixedCount(int64 Count)
Definition SampleSetStatistics.h:118
void AccumulateValue_FixedCount(int32 StatisticIndex, const RealType Value)
Definition SampleSetStatistics.h:142
void CompleteSecondPass_FixedCount()
Definition SampleSetStatistics.h:134
TSampleSetStatisticBuilder(int32 NumStatisticsIn=1)
Definition SampleSetStatistics.h:109
Definition SampleSetStatistics.h:48
RealType CountDivide
Definition SampleSetStatistics.h:50
int32 PassNum
Definition SampleSetStatistics.h:49
Definition SampleSetStatistics.h:19
TInterval1< RealType > Range
Definition SampleSetStatistics.h:24
int64 Count
Definition SampleSetStatistics.h:21
void AccumulateValue_FixedCount(const RealType Value, FFixedCountData &DataInOut)
Definition SampleSetStatistics.h:78
void CompleteSecondPass_FixedCount(FFixedCountData &DataInOut)
Definition SampleSetStatistics.h:73
RealType StandardDeviation
Definition SampleSetStatistics.h:30
FFixedCountData Begin_FixedCount(int64 CountIn)
Definition SampleSetStatistics.h:53
RealType Mean
Definition SampleSetStatistics.h:27
void StartSecondPass_FixedCount(FFixedCountData &DataInOut)
Definition SampleSetStatistics.h:66