1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-26 19:17:52 +00:00

Entrust the FilterGenerator.

This commit is contained in:
Thomas Harte
2026-01-16 11:43:05 -05:00
parent 665cdc38cc
commit 89e8e20fcf
4 changed files with 110 additions and 131 deletions
+17 -3
View File
@@ -122,11 +122,24 @@ public:
CoefficientType operator[](const size_t index) const {
return coefficients_[index];
}
CoefficientType &operator[](const size_t index) {
return coefficients_[index];
}
size_t size() const {
return coefficients_.size();
}
using iterator = std::vector<CoefficientType>::iterator;
iterator begin() {
return coefficients_.begin();
}
iterator end() {
return coefficients_.end();
}
template <typename IteratorT>
void copy_to(
IteratorT begin,
@@ -161,15 +174,16 @@ public:
});
}
FIRFilter &operator *(const CoefficientType rhs) {
for(auto &coefficient: coefficients_) {
FIRFilter operator *(const CoefficientType rhs) {
auto copy = *this;
for(auto &coefficient: copy.coefficients_) {
if constexpr (type == ScalarType::Float) {
coefficient *= rhs;
} else {
coefficient = (coefficient * rhs) >> FixedShift;
}
}
return *this;
return copy;
}
private: