- added statistics folder
git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@1042 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#ifndef _STATISTICS_SLIDINGMINMAX_HPP_
|
||||
#define _STATISTICS_SLIDINGMINMAX_HPP_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cpp/radio/Vector.hpp>
|
||||
#include <cpp/radio/statistics/SlidingMinMax.hpp>
|
||||
#include <stddef.h>
|
||||
#include <blaze/Blaze.h>
|
||||
|
||||
|
||||
namespace Radio
|
||||
{
|
||||
namespace Statistics
|
||||
{
|
||||
|
||||
// Sliding Min/Max based on MAXLIST-Algorithm, based on:
|
||||
// "AN EFFICIENT ALGORITHM FOR RUNNING MAX MIN CALCULATION", 1996, S.C. Douglas, University of Utah
|
||||
// Dependeding on 'mode' this algorithm calculates either minimum (mode = -1) or maximum (mode = +1)
|
||||
template <typename T>
|
||||
class SlidingMinMax
|
||||
{
|
||||
public:
|
||||
enum Mode
|
||||
{
|
||||
Min,
|
||||
Max
|
||||
};
|
||||
|
||||
SlidingMinMax(Mode mode, size_t L, T P);
|
||||
~SlidingMinMax();
|
||||
void process(T const &xin);
|
||||
T getWinner()
|
||||
{
|
||||
return m_win_value;
|
||||
}
|
||||
private:
|
||||
size_t m_L;
|
||||
T m_P;
|
||||
size_t m_N;
|
||||
Mode m_mode;
|
||||
RealScalar m_mode_value;
|
||||
T m_win_value;
|
||||
size_t m_win_index;
|
||||
|
||||
blaze::DynamicVector<T> m_pU;
|
||||
blaze::DynamicVector<T> m_pU_last;
|
||||
blaze::DynamicVector<size_t> m_pP;
|
||||
blaze::DynamicVector<size_t> m_pP_last;
|
||||
|
||||
};
|
||||
|
||||
#include "SlidingMinMax.tcc"
|
||||
|
||||
} // Statistics
|
||||
} // Radio
|
||||
|
||||
#endif // _STATISTICS_SLIDINGMINMAX_HPP_
|
||||
Reference in New Issue
Block a user