Trait basic_dsp::Interpolation
[−]
[src]
pub trait Interpolation<T>: DataVector<T> where T: RealNumber { fn interpolatef(self, function: &RealImpulseResponse<T>, interpolation_factor: T, delay: T, conv_len: usize) -> VecResult<Self>; fn interpolatei(self, function: &RealFrequencyResponse<T>, interpolation_factor: u32) -> VecResult<Self>; fn decimatei(self, decimation_factor: u32, delay: u32) -> VecResult<Self>; }
Provides interpolation operations for real and complex data vectors.
Unstable
This functionality has been recently added in order to find out if the definitions are consistent. However the actual implementation is lacking tests.
Required Methods
fn interpolatef(self, function: &RealImpulseResponse<T>, interpolation_factor: T, delay: T, conv_len: usize) -> VecResult<Self>
Interpolates self
with the convolution function function
by the real value interpolation_factor
.
Interpolation is done in 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(self, function: &RealFrequencyResponse<T>, interpolation_factor: u32) -> VecResult<Self>
Interpolates self
with the convolution function function
by the interger value interpolation_factor
.
Interpolation is done in in frequency domain.
See the description of interpolatef
for some basic performance considerations.
Failures
VecResult may report the following ErrorReason
members:
ArgumentFunctionMustBeSymmetric
: if!self.is_complex() && !function.is_symmetric()
or in words ifself
is a real vector andfunction
is asymmetric. Converting the vector into a complex vector before the interpolation is one way to resolve this error.
fn decimatei(self, decimation_factor: u32, delay: u32) -> VecResult<Self>
Decimates or downsamples self
. decimatei
is the inverse function to interpolatei
.
Implementors
impl Interpolation<f32> for GenericDataVector<f32>
impl Interpolation<f64> for GenericDataVector<f64>
impl Interpolation<f32> for RealTimeVector<f32>
impl Interpolation<f64> for RealTimeVector<f64>
impl Interpolation<f32> for ComplexTimeVector<f32>
impl Interpolation<f64> for ComplexTimeVector<f64>
impl Interpolation<f32> for RealFreqVector<f32>
impl Interpolation<f64> for RealFreqVector<f64>
impl Interpolation<f32> for ComplexFreqVector<f32>
impl Interpolation<f64> for ComplexFreqVector<f64>