[][src]Trait basic_dsp_vector::InterpolationOps

pub trait InterpolationOps<S, T> where
    S: ToSliceMut<T>,
    T: RealNumber
{ fn interpolatef<B>(
        &mut self,
        buffer: &mut B,
        function: &dyn RealImpulseResponse<T>,
        interpolation_factor: T,
        delay: T,
        conv_len: usize
    )
    where
        B: for<'a> Buffer<'a, S, T>
;
fn interpolatei<B>(
        &mut self,
        buffer: &mut B,
        function: &dyn RealFrequencyResponse<T>,
        interpolation_factor: u32
    ) -> VoidResult
    where
        B: for<'a> Buffer<'a, S, T>
;
fn interpolate<B>(
        &mut self,
        buffer: &mut B,
        function: Option<&dyn RealFrequencyResponse<T>>,
        target_points: usize,
        delay: T
    ) -> VoidResult
    where
        B: for<'a> Buffer<'a, S, T>
;
fn interpft<B>(&mut self, buffer: &mut B, target_points: usize)
    where
        B: for<'a> Buffer<'a, S, T>
;
fn decimatei(&mut self, decimation_factor: u32, delay: u32); }

Provides interpolation operations for real and complex data vectors.

Required methods

fn interpolatef<B>(
    &mut self,
    buffer: &mut B,
    function: &dyn RealImpulseResponse<T>,
    interpolation_factor: T,
    delay: T,
    conv_len: usize
) where
    B: for<'a> Buffer<'a, S, T>, 

Interpolates self with the convolution function function by the real value interpolation_factor. InterpolationOps is done in time domain and the argument conv_len can be used to balance accuracy and computational performance. A delay can be used to delay or phase shift the vector. The delay considers self.delta().

The complexity of this interpolatef is O(self.points() * conv_len), while for interpolatei it's O(self.points() * log(self.points())). If computational performance is important you should therefore decide how large conv_len needs to be to yield the desired accuracy. If you compare conv_len to log(self.points) you should get a feeling for the expected performance difference. More important is however to do a test run to compare the speed of interpolatef and interpolatei. Together with the information that changing the vectors size change log(self.points() but not conv_len gives the indication that interpolatef performs faster for larger vectors while interpolatei performs faster for smaller vectors.

fn interpolatei<B>(
    &mut self,
    buffer: &mut B,
    function: &dyn RealFrequencyResponse<T>,
    interpolation_factor: u32
) -> VoidResult where
    B: for<'a> Buffer<'a, S, T>, 

Interpolates self with the convolution function function by the integer value interpolation_factor. InterpolationOps is done in in frequency domain.

See the description of interpolatef for some basic performance considerations.

Failures

TransRes may report the following ErrorReason members:

  1. ArgumentFunctionMustBeSymmetric: if !self.is_complex() && !function.is_symmetric() or in words if self is a real vector and function is asymmetric. Converting the vector into a complex vector before the interpolation is one way to resolve this error.

fn interpolate<B>(
    &mut self,
    buffer: &mut B,
    function: Option<&dyn RealFrequencyResponse<T>>,
    target_points: usize,
    delay: T
) -> VoidResult where
    B: for<'a> Buffer<'a, S, T>, 

Interpolates the signal in frequency domain by padding it with zeros.

fn interpft<B>(&mut self, buffer: &mut B, target_points: usize) where
    B: for<'a> Buffer<'a, S, T>, 

Interpolates the signal in frequency domain by padding it with zeros. This function preserves the shape of the signal in frequency domain.

Calling this function is the same as calling interpolate with None as function and 0.0 as delay.

fn decimatei(&mut self, decimation_factor: u32, delay: u32)

Decimates or downsamples self. decimatei is the inverse function to interpolatei.

Loading content...

Implementors

impl<S, T, N, D> InterpolationOps<S, T> for DspVec<S, T, N, D> where
    DspVec<S, T, N, D>: InsertZerosOpsBuffered<S, T> + ScaleOps<T> + ResizeBufferedOps<S, T>,
    S: ToSliceMut<T> + ToComplexVector<S, T> + ToDspVector<T>,
    T: RealNumber,
    N: NumberSpace,
    D: Domain
[src]

Loading content...