FastLED 3.9.15
Loading...
Searching...
No Matches

◆ update() [1/2]

template<typename T, fl::size N = 0>
T fl::detail::AlphaTrimmedMeanImpl< T, N >::update ( fl::span< const T > values)
inline

Definition at line 20 of file alpha_trimmed_mean_impl.h.

20 {
21 if (values.size() == 0) return mLastValue;
22 for (fl::size i = 0; i < values.size(); ++i) {
23 mRing.push_back(values[i]);
24 }
25 // Rebuild sorted array from ring contents
26 mSortedCount = mRing.size();
27 for (fl::size i = 0; i < mSortedCount; ++i) {
28 mSorted[i] = mRing[i];
29 }
31 // Compute trimmed mean
34 if (lo >= hi) {
36 } else {
37 T sum = T(0);
38 for (fl::size i = lo; i < hi; ++i) {
39 sum = sum + mSorted[i];
40 }
42 }
43 return mLastValue;
44 }
fl::enable_if< fl::is_floating_point< T >::value, T >::type div_by_count(T sum, fl::size count)
void sort(Iterator first, Iterator last, Compare comp) FL_NOEXCEPT
Definition algorithm.h:564

References fl::detail::div_by_count(), mLastValue, mRing, mSorted, mSortedCount, mTrimCount, fl::span< T, Extent >::size(), and fl::sort().

+ Here is the call graph for this function: