Types.h
#ifndef IIR1_TYPES_H
#define IIR1_TYPES_H
#include "Common.h"
#include "MathSupplement.h"
#include <stdexcept>
namespace Iir {
struct DllExport ComplexPair : complex_pair_t
{
ComplexPair ()
{
}
explicit ComplexPair (const complex_t& c1)
: complex_pair_t (c1, 0.)
{
if (!isReal()) throw std::invalid_argument("A single complex number needs to be real.");
}
ComplexPair (const complex_t& c1,
const complex_t& c2)
: complex_pair_t (c1, c2)
{
}
bool isConjugate () const
{
return second == std::conj (first);
}
bool isReal () const
{
return first.imag() == 0 && second.imag() == 0;
}
bool isMatchedPair () const
{
if (first.imag() != 0)
return second == std::conj (first);
else
return second.imag () == 0 &&
second.real () != 0 &&
first.real () != 0;
}
bool is_nan () const
{
return Iir::is_nan (first) || Iir::is_nan (second);
}
};
struct DllExport PoleZeroPair
{
ComplexPair poles;
ComplexPair zeros;
PoleZeroPair () { }
// single pole/zero
PoleZeroPair (const complex_t& p, const complex_t& z)
: poles (p), zeros (z)
{
}
// pole/zero pair
PoleZeroPair (const complex_t& p1, const complex_t& z1,
const complex_t& p2, const complex_t& z2)
: poles (p1, p2)
, zeros (z1, z2)
{
}
bool isSinglePole () const
{
return poles.second == 0. && zeros.second == 0.;
}
bool is_nan () const
{
return poles.is_nan() || zeros.is_nan();
}
};
enum Kind
{
kindLowPass,
kindHighPass,
kindBandPass,
kindBandStop,
kindLowShelf,
kindHighShelf,
kindBandShelf,
kindOther
};
}
#endif
Iir::ComplexPair
Definition: Types.h:48
Iir::ComplexPair::isMatchedPair
bool isMatchedPair() const
Definition: Types.h:80
Iir::Kind
Kind
Definition: Types.h:136
Iir
Definition: Biquad.cpp:41
Iir::PoleZeroPair
Definition: Types.h:100