- fixed mutual inclusions git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@865 b431acfa-c32f-4a4a-93f1-934dc6c82436
71 lines
1.1 KiB
C++
71 lines
1.1 KiB
C++
/*
|
|
* File: FirComplex.hpp
|
|
* Author: jens
|
|
*
|
|
* Created on 20. Dezember 2014, 08:12
|
|
*/
|
|
|
|
#ifndef _RADIO_FIRCOMPLEX_HPP_
|
|
#define _RADIO_FIRCOMPLEX_HPP_
|
|
|
|
#include "Vector.hpp"
|
|
|
|
namespace Radio
|
|
{
|
|
|
|
class FirComplex
|
|
{
|
|
public:
|
|
FirComplex(uint32_t numTaps = 0)
|
|
: m_numTaps(numTaps)
|
|
, m_state(numTaps)
|
|
{
|
|
}
|
|
virtual ~FirComplex()
|
|
{
|
|
|
|
}
|
|
|
|
void setNumTaps(uint32_t numTaps)
|
|
{
|
|
m_numTaps = numTaps;
|
|
m_state.resize(numTaps);
|
|
m_state.fill(ComplexScalar(0,0));
|
|
}
|
|
|
|
void feed(ComplexScalar const &x)
|
|
{
|
|
m_state.reverse() << m_state.head(m_numTaps-1).reverse(), x;
|
|
}
|
|
|
|
static void feed(CVec &state, ComplexScalar const &x)
|
|
{
|
|
state.reverse() << state.head(state.size()-1).reverse(), x;
|
|
}
|
|
|
|
ComplexScalar process(CVec const &coeff)
|
|
{
|
|
return m_state.transpose() * coeff.conjugate();
|
|
}
|
|
|
|
ComplexScalar processReal(RVec const &coeff)
|
|
{
|
|
return m_state.transpose() * coeff;
|
|
}
|
|
|
|
static ComplexScalar processReal(CVec const &state, RVec const &coeff)
|
|
{
|
|
return state.transpose() * coeff;
|
|
}
|
|
|
|
protected:
|
|
uint32_t m_numTaps;
|
|
CVec m_state;
|
|
|
|
};
|
|
|
|
} // ::Radio
|
|
|
|
#endif /* _RADIO_FIRCOMPLEX_HPP_ */
|
|
|