- FirComplex: Added static process()

git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@105 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2014-12-22 17:36:24 +00:00
parent edbe93987d
commit 4f726e0285
2 changed files with 21 additions and 11 deletions
+17 -7
View File
@@ -18,7 +18,7 @@ class FirComplex
public:
FirComplex(uint32_t numTaps = 0)
: m_numTaps(numTaps)
, m_x(numTaps)
, m_state(numTaps)
{
}
virtual ~FirComplex()
@@ -29,28 +29,38 @@ public:
void setNumTaps(uint32_t numTaps)
{
m_numTaps = numTaps;
m_x.resize(numTaps);
m_x.fill(ComplexScalar(0,0));
m_state.resize(numTaps);
m_state.fill(ComplexScalar(0,0));
}
void feed(ComplexScalar const &x)
{
m_x.reverse() << m_x.head(m_numTaps-1).reverse(), 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_x.transpose() * coeff.conjugate();
return m_state.transpose() * coeff.conjugate();
}
ComplexScalar processReal(RVec const &coeff)
{
return m_x.transpose() * 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_x;
CVec m_state;
};