Closed mipac closed 3 years ago
Hi,
reinterpret_cast
is absolutely correct here as the complex types have same layout in memory.
The custom type for complex values is intended for better conversion performance in FFT code.
The issue with combining std and kfr types will be resolved in the next release (that is in progress).
Best regards
great! thanks a lot
I'm not sure to understand well, does it mean that fft with std is less optimal? what do you mean by conversion ?
The performance impact is negligible for most cases and only affects passing and receiving data to/from KFR algorithms. Internally, DFT and other DSP algorithms in KFR don't do conversion at all and use vectors of regular floating point types with highly optimized functions doing all required complex math under the hood.
The fix for using std::complex
has been pushed to dev
.
Now you can use KFR_STD_COMPLEX
cmake parameter to control using std::complex
for data passing/receiving data. Set it to ON
and rebuild KFR to make kfr::complex<>
an alias for std::complex<>
.
thank you very much
Hi, I have trouble with float complex type. I try to use std::complex to make easier the integration with other code and I have compiler errors.
for example with the resampler:
.../include/kfr/dsp/sample_rate_conversion.hpp:115:25: error: invalid operands to binary expression ('kfr::sse2::samplerate_converter<std::complex >::ftype' (aka 'std::complex') and 'const long')
cutoff = cutoff / std::max(decimation_factor, interpolation_factor);