kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit 79a7bc6fd234a658d173d0538f51c9d51ca24b05
parent 0aa56368555fb72807418253a4d9bd1bebbd75a7
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Tue, 20 Nov 2018 06:26:16 +0000

Fix std::complex

Diffstat:
Minclude/kfr/base/expression.hpp | 13+++++++++++++
Mtests/dsp_test.cpp | 15+++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/kfr/base/expression.hpp b/include/kfr/base/expression.hpp @@ -30,6 +30,9 @@ #include "vec.hpp" #include <tuple> +#ifdef KFR_STD_COMPLEX +#include <complex> +#endif CMT_PRAGMA_GNU(GCC diagnostic push) CMT_PRAGMA_GNU(GCC diagnostic ignored "-Wshadow") @@ -55,8 +58,18 @@ using cinput_t = const cinput_context*; constexpr cinput_t cinput = nullptr; constexpr coutput_t coutput = nullptr; +#ifdef KFR_STD_COMPLEX + +template <typename T> +using complex = std::complex<T>; + +#else +#ifndef KFR_CUSTOM_COMPLEX + template <typename> struct complex; +#endif +#endif constexpr size_t infinite_size = static_cast<size_t>(-1); diff --git a/tests/dsp_test.cpp b/tests/dsp_test.cpp @@ -307,6 +307,7 @@ TEST(fir) }); } +#ifdef KFR_NATIVE_F64 TEST(fir_different) { const univector<float, 100> data = counter() + sequence(1, 2, -10, 100) + sequence(0, -7, 0.5f); @@ -326,7 +327,20 @@ TEST(fir_different) return float(result); }); } +#endif +#ifdef KFR_STD_COMPLEX +template <typename T> +inline std::complex<T> to_std(const std::complex<T>& c) +{ + return c; +} +template <typename T> +inline std::complex<T> from_std(const std::complex<T>& c) +{ + return c; +} +#else template <typename T> inline std::complex<T> to_std(const kfr::complex<T>& c) { @@ -338,6 +352,7 @@ inline kfr::complex<T> from_std(const std::complex<T>& c) { return { c.real(), c.imag() }; } +#endif TEST(fir_complex) {