iir1
Toggle main menu visibility
Loading...
Searching...
No Matches
iir
Types.h
1
35
36
#pragma once
37
38
#include "Common.h"
39
#include "MathSupplement.h"
40
41
namespace
Iir
{
42
46
struct
IIR_EXPORT ComplexPair : complex_pair_t
47
{
48
ComplexPair() =
default
;
49
50
explicit
ComplexPair (
const
complex_t& c1)
51
: complex_pair_t (c1, 0.)
52
{
53
if
(!isReal()) throw_invalid_argument(
"A single complex number needs to be real."
);
54
}
55
56
ComplexPair (
const
complex_t& c1,
57
const
complex_t& c2)
58
: complex_pair_t (c1, c2)
59
{
60
}
61
62
bool
isReal ()
const
63
{
64
return
first.imag() == 0 && second.imag() == 0;
65
}
66
71
bool
isMatchedPair
()
const
72
{
73
if
(first.imag() != 0)
74
return
second == std::conj (first);
75
else
76
return
second.imag () == 0 &&
77
second.real () != 0 &&
78
first.real () != 0;
79
}
80
81
bool
is_nan ()
const
82
{
83
return
Iir::is_nan (first) || Iir::is_nan (second);
84
}
85
};
86
87
91
struct
IIR_EXPORT PoleZeroPair
92
{
93
ComplexPair
poles =
ComplexPair
();
94
ComplexPair
zeros =
ComplexPair
();
95
96
PoleZeroPair () =
default
;
97
98
// single pole/zero
99
PoleZeroPair (
const
complex_t& p,
const
complex_t& z)
100
: poles (p), zeros (z)
101
{
102
}
103
104
// pole/zero pair
105
PoleZeroPair (
const
complex_t& p1,
const
complex_t& z1,
106
const
complex_t& p2,
const
complex_t& z2)
107
: poles (p1, p2)
108
, zeros (z1, z2)
109
{
110
}
111
112
bool
isSinglePole ()
const
113
{
114
return
poles.second == 0. && zeros.second == 0.;
115
}
116
117
bool
is_nan ()
const
118
{
119
return
poles.is_nan() || zeros.is_nan();
120
}
121
};
122
123
124
}
Iir
Definition
Biquad.cpp:40
Iir::ComplexPair
Definition
Types.h:47
Iir::ComplexPair::isMatchedPair
bool isMatchedPair() const
Definition
Types.h:71
Generated on
for iir1 by
1.17.0