basic_dsp_vector 0.5.6

Digital signal processing based on real or complex vectors in time or frequency domain. Vectors come with basic arithmetic, convolution, Fourier transformation and interpolation operations. The vectors are optimized for sizes of a couple of thousand elements or more.
Documentation
//! Fallback implementation in case no explicit `sse` or `avx` support is available.
//! In this case we use the standard versions of all functions which and no approximations.
//! We do that since this way the API doesn't change (so much) depending on the selected features.
//! However at the same time finding an alternative approximation implementation without
//! explicit SIMD support would be too much effort and therefore we use the standard functions.
//! This way we can also be sure that we achieve the promised unertainty :).
//! The Rust compiler does a good job to remove the otherhead of this implementation.
//! So in benchmarks this implementation has the same speed as the the standard functions.

use super::fallback;
use super::{SimdApproximations, SimdGeneric};

macro_rules! simd_approx_impl {
    ($data_type:ident,
	 $regf:ident) => {
        impl SimdApproximations<$data_type> for fallback::$regf {
            fn ln_approx(self) -> Self {
                self.iter_over_vector(|x: $data_type| x.ln())
            }
        
            fn exp_approx(self) -> Self {
                self.iter_over_vector(|x: $data_type| x.exp())
            }
        
            fn sin_approx(self) -> Self {
                self.iter_over_vector(|x: $data_type| x.sin())
            }
        
            fn cos_approx(self) -> Self {
                self.iter_over_vector(|x: $data_type| x.cos())
            }
        
            fn sin_cos_approx(self, is_sin: bool) -> Self {
                if is_sin {
                    self.sin_approx()
                } else {
                    self.cos_approx()
                }
            }
        }
    };
}

simd_approx_impl!(f32, f32x4);
simd_approx_impl!(f64, f64x2);