summaryrefslogtreecommitdiffstats
path: root/src/MemlessPoly.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-08-23 10:30:57 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-08-23 10:30:57 +0200
commit468b74b0a8ca54fdc726bf354dcf4f040ddc3060 (patch)
tree3db07b111b0997079a1a3616b763d63dce0fefee /src/MemlessPoly.cpp
parent2f29bec66f0d072934334b0aa5f8094e550a3a8f (diff)
downloaddabmod-468b74b0a8ca54fdc726bf354dcf4f040ddc3060.tar.gz
dabmod-468b74b0a8ca54fdc726bf354dcf4f040ddc3060.tar.bz2
dabmod-468b74b0a8ca54fdc726bf354dcf4f040ddc3060.zip
DPD: use std::norm
Diffstat (limited to 'src/MemlessPoly.cpp')
-rw-r--r--src/MemlessPoly.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/MemlessPoly.cpp b/src/MemlessPoly.cpp
index 25a0a23..7da868e 100644
--- a/src/MemlessPoly.cpp
+++ b/src/MemlessPoly.cpp
@@ -123,15 +123,13 @@ void MemlessPoly::load_coefficients(const std::string &coefFile)
/* The restrict keyword is C99, g++ and clang++ however support __restrict
* instead, and this allows the compiler to auto-vectorize the loop.
*/
-
static void apply_coeff(
const vector<float> &coefs,
const complexf *__restrict in, size_t start, size_t stop,
complexf *__restrict out)
{
- for (size_t i = start; i < stop; i+=1) {
-
- float in_mag_sq = in[i].real() * in[i].real() + in[i].imag() * in[i].imag();
+ for (size_t i = start; i < stop; i++) {
+ const float in_mag_sq = std::norm(in[i]);
out[i] =
in[i] *
( coefs[0] + in_mag_sq *