Struct basic_dsp::GenericDataVector [] [src]

pub struct GenericDataVector<T> where T: RealNumber {
    // some fields omitted
}

A 1xN (one times N elements) or Nx1 data vector as used for most digital signal processing (DSP) operations. All data vector operations consume the vector they operate on and return a new vector. A consumed vector must not be accessed again.

Vectors come in different flavors:

  1. Time or Frequency domain
  2. Real or Complex numbers
  3. 32bit or 64bit floating point numbers

The first two flavors define meta information about the vector and provide compile time information what operations are available with the given vector and how this will transform the vector. This makes sure that some invalid operations are already discovered at compile time. In case that this isn't desired or the information about the vector isn't known at compile time there are the generic DataVector32 and DataVector64 vectors available.

32bit and 64bit flavors trade performance and memory consumption against accuracy. 32bit vectors are roughly two times faster than 64bit vectors for most operations. But remember that you should benchmark first before you give away accuracy for performance unless however you are sure that 32bit accuracy is certainly good enough.

Methods

impl GenericDataVector<f32>
[src]

fn new_with_options(is_complex: bool, domain: DataVectorDomain, init_value: f32, length: usize, delta: f32, options: MultiCoreSettings) -> Self

Same as new but also allows to set multicore options.

fn from_array_with_options(is_complex: bool, domain: DataVectorDomain, data: &[f32], options: MultiCoreSettings) -> Self

Same as from_array but also allows to set multicore options.

fn from_array_no_copy_with_options(is_complex: bool, domain: DataVectorDomain, data: Vec<f32>, options: MultiCoreSettings) -> Self

Same as from_array_no_copy but also allows to set multicore options.

fn from_array_with_delta_and_options(is_complex: bool, domain: DataVectorDomain, data: &[f32], delta: f32, options: MultiCoreSettings) -> Self

Same as from_array_with_delta but also allows to set multicore options.

fn from_array_no_copy_with_delta_and_options(is_complex: bool, domain: DataVectorDomain, data: Vec<f32>, delta: f32, options: MultiCoreSettings) -> Self

Same as from_array_no_copy_with_delta but also allows to set multicore options.

fn new(is_complex: bool, domain: DataVectorDomain, init_value: f32, length: usize, delta: f32) -> Self

Creates a new generic data vector from the given arguments.

fn from_array(is_complex: bool, domain: DataVectorDomain, data: &[f32]) -> Self

Creates a new generic data vector from the given arguments.

fn from_array_no_copy(is_complex: bool, domain: DataVectorDomain, data: Vec<f32>) -> Self

Creates a new generic data vector from the given arguments.

fn from_array_with_delta(is_complex: bool, domain: DataVectorDomain, data: &[f32], delta: f32) -> Self

Creates a new generic data vector from the given arguments.

fn from_array_no_copy_with_delta(is_complex: bool, domain: DataVectorDomain, data: Vec<f32>, delta: f32) -> Self

Creates a new generic data vector from the given arguments.

impl GenericDataVector<f64>
[src]

fn new_with_options(is_complex: bool, domain: DataVectorDomain, init_value: f64, length: usize, delta: f64, options: MultiCoreSettings) -> Self

Same as new but also allows to set multicore options.

fn from_array_with_options(is_complex: bool, domain: DataVectorDomain, data: &[f64], options: MultiCoreSettings) -> Self

Same as from_array but also allows to set multicore options.

fn from_array_no_copy_with_options(is_complex: bool, domain: DataVectorDomain, data: Vec<f64>, options: MultiCoreSettings) -> Self

Same as from_array_no_copy but also allows to set multicore options.

fn from_array_with_delta_and_options(is_complex: bool, domain: DataVectorDomain, data: &[f64], delta: f64, options: MultiCoreSettings) -> Self

Same as from_array_with_delta but also allows to set multicore options.

fn from_array_no_copy_with_delta_and_options(is_complex: bool, domain: DataVectorDomain, data: Vec<f64>, delta: f64, options: MultiCoreSettings) -> Self

Same as from_array_no_copy_with_delta but also allows to set multicore options.

fn new(is_complex: bool, domain: DataVectorDomain, init_value: f64, length: usize, delta: f64) -> Self

Creates a new generic data vector from the given arguments.

fn from_array(is_complex: bool, domain: DataVectorDomain, data: &[f64]) -> Self

Creates a new generic data vector from the given arguments.

fn from_array_no_copy(is_complex: bool, domain: DataVectorDomain, data: Vec<f64>) -> Self

Creates a new generic data vector from the given arguments.

fn from_array_with_delta(is_complex: bool, domain: DataVectorDomain, data: &[f64], delta: f64) -> Self

Creates a new generic data vector from the given arguments.

fn from_array_no_copy_with_delta(is_complex: bool, domain: DataVectorDomain, data: Vec<f64>, delta: f64) -> Self

Creates a new generic data vector from the given arguments.

impl GenericDataVector<f32>
[src]

fn perform_operations(self, operations: &[Operation<f32>]) -> Self

Perform a set of operations on the given vector. Warning: Highly unstable and not even fully implemented right now.

With this approach we change how we operate on vectors. If you perform M operations on a vector with the length N you iterate wit hall other methods like this:

// pseudocode:
// for m in M:
//  for n in N:
//    execute m on n

with this method the pattern is changed slighly:

// pseudocode:
// for n in N:
//  for m in M:
//    execute m on n

Both variants have the same complexity however the second one is benificial since we have increased locality this way. This should help us by making better use of registers and CPU buffers. This might also help since for large data we might have the chance in future to move the data to a GPU, run all operations and get the result back. In this case the GPU is fast for many operations but the roundtrips on the bus should be minimized to keep the speed advantage.

Trait Implementations

impl GenericVectorOperations<f32> for GenericDataVector<f32>
[src]

fn add_vector(self, summand: &Self) -> VecResult<Self>

Calculates the sum of self + summand. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn add_smaller_vector(self, summand: &Self) -> VecResult<Self>

Calculates the sum of self + summand. summand may be smaller than self as long as self.len() % summand.len() == 0. THe result is the same as it would be if you would repeat summand until it has the same length as self. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn subtract_vector(self, summand: &Self) -> VecResult<Self>

Calculates the difference of self - subtrahend. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn subtract_smaller_vector(self, summand: &Self) -> VecResult<Self>

Calculates the sum of self - subtrahend. subtrahend may be smaller than self as long as self.len() % subtrahend.len() == 0. THe result is the same as it would be if you would repeat subtrahend until it has the same length as self. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn multiply_vector(self, factor: &Self) -> VecResult<Self>

Calculates the product of self * factor. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn multiply_smaller_vector(self, factor: &Self) -> VecResult<Self>

Calculates the sum of self - factor. factor may be smaller than self as long as self.len() % factor.len() == 0. THe result is the same as it would be if you would repeat factor until it has the same length as self. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn divide_vector(self, divisor: &Self) -> VecResult<Self>

Calculates the quotient of self / summand. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn divide_smaller_vector(self, divisor: &Self) -> VecResult<Self>

Calculates the sum of self - divisor. divisor may be smaller than self as long as self.len() % divisor.len() == 0. THe result is the same as it would be if you would repeat divisor until it has the same length as self. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn zero_pad(self, points: usize, option: PaddingOption) -> VecResult<Self>

Appends zeros add the end of the vector until the vector has the size given in the points argument. If points smaller than the self.len() then this operation won't do anything. Read more

fn reverse(self) -> VecResult<Self>

Reverses the data inside the vector.

fn zero_interleave(self, factor: u32) -> VecResult<Self>

Ineterleaves zeros factor - 1times after every vector element, so that the resulting vector will have a length of self.len() * factor. Read more

fn diff(self) -> VecResult<Self>

Calculates the delta of each elements to its previous element. This will decrease the vector length by one point. Read more

fn diff_with_start(self) -> VecResult<Self>

Calculates the delta of each elements to its previous element. The first element will remain unchanged. Read more

fn cum_sum(self) -> VecResult<Self>

Calculates the cumulative sum of all elements. This operation undoes the diff_with_startoperation. Read more

fn sqrt(self) -> VecResult<Self>

Gets the square root of all vector elements. Read more

fn square(self) -> VecResult<Self>

Squares all vector elements. Read more

fn root(self, degree: f32) -> VecResult<Self>

Calculates the n-th root of every vector element. Read more

fn power(self, exponent: f32) -> VecResult<Self>

Raises every vector element to the given power. Read more

fn logn(self) -> VecResult<Self>

Calculates the natural logarithm to the base e for every vector element. Read more

fn expn(self) -> VecResult<Self>

Calculates the natural exponential to the base e for every vector element. Read more

fn log_base(self, base: f32) -> VecResult<Self>

Calculates the logarithm to the given base for every vector element. Read more

fn exp_base(self, base: f32) -> VecResult<Self>

Calculates the exponential to the given base for every vector element. Read more

fn sin(self) -> VecResult<Self>

Calculates the sine of each element in radians. Read more

fn cos(self) -> VecResult<Self>

Calculates the cosine of each element in radians. Read more

fn tan(self) -> VecResult<Self>

Calculates the tangent of each element in radians.

fn asin(self) -> VecResult<Self>

Calculates the principal value of the inverse sine of each element in radians.

fn acos(self) -> VecResult<Self>

Calculates the principal value of the inverse cosine of each element in radians.

fn atan(self) -> VecResult<Self>

Calculates the principal value of the inverse tangent of each element in radians.

fn sinh(self) -> VecResult<Self>

Calculates the hyperbolic sine each element in radians.

fn cosh(self) -> VecResult<Self>

Calculates the hyperbolic cosine each element in radians.

fn tanh(self) -> VecResult<Self>

Calculates the hyperbolic tangent each element in radians.

fn asinh(self) -> VecResult<Self>

Calculates the principal value of the inverse hyperbolic sine of each element in radians.

fn acosh(self) -> VecResult<Self>

Calculates the principal value of the inverse hyperbolic cosine of each element in radians.

fn atanh(self) -> VecResult<Self>

Calculates the principal value of the inverse hyperbolic tangent of each element in radians.

fn swap_halves(self) -> VecResult<Self>

This function swaps both halves of the vector. This operation is also called fft shift Use it after a plain_fft to get a spectrum which is centered at 0 Hz. Read more

fn override_data(self, data: &[f32]) -> VecResult<Self>

Overrides the data in the vector with the given data. This may also change the vectors length (however not the allocated length). Read more

fn split_into(&self, targets: &mut [Box<Self>]) -> VoidResult

Splits the vector into several smaller vectors. self.len() must be dividable by targets.len() without a remainder and this conidition must be true too targets.len() > 0. # Failures VecResult may report the following ErrorReason members: Read more

fn merge(self, sources: &[Box<Self>]) -> VecResult<Self>

Merges several vectors into self. All vectors must have the same size and at least one vector must be provided. # Failures VecResult may report the following ErrorReason members: Read more

impl GenericVectorOperations<f64> for GenericDataVector<f64>
[src]

fn add_vector(self, summand: &Self) -> VecResult<Self>

Calculates the sum of self + summand. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn add_smaller_vector(self, summand: &Self) -> VecResult<Self>

Calculates the sum of self + summand. summand may be smaller than self as long as self.len() % summand.len() == 0. THe result is the same as it would be if you would repeat summand until it has the same length as self. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn subtract_vector(self, summand: &Self) -> VecResult<Self>

Calculates the difference of self - subtrahend. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn subtract_smaller_vector(self, summand: &Self) -> VecResult<Self>

Calculates the sum of self - subtrahend. subtrahend may be smaller than self as long as self.len() % subtrahend.len() == 0. THe result is the same as it would be if you would repeat subtrahend until it has the same length as self. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn multiply_vector(self, factor: &Self) -> VecResult<Self>

Calculates the product of self * factor. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn multiply_smaller_vector(self, factor: &Self) -> VecResult<Self>

Calculates the sum of self - factor. factor may be smaller than self as long as self.len() % factor.len() == 0. THe result is the same as it would be if you would repeat factor until it has the same length as self. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn divide_vector(self, divisor: &Self) -> VecResult<Self>

Calculates the quotient of self / summand. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn divide_smaller_vector(self, divisor: &Self) -> VecResult<Self>

Calculates the sum of self - divisor. divisor may be smaller than self as long as self.len() % divisor.len() == 0. THe result is the same as it would be if you would repeat divisor until it has the same length as self. It consumes self and returns the result. # Failures VecResult may report the following ErrorReason members: Read more

fn zero_pad(self, points: usize, option: PaddingOption) -> VecResult<Self>

Appends zeros add the end of the vector until the vector has the size given in the points argument. If points smaller than the self.len() then this operation won't do anything. Read more

fn reverse(self) -> VecResult<Self>

Reverses the data inside the vector.

fn zero_interleave(self, factor: u32) -> VecResult<Self>

Ineterleaves zeros factor - 1times after every vector element, so that the resulting vector will have a length of self.len() * factor. Read more

fn diff(self) -> VecResult<Self>

Calculates the delta of each elements to its previous element. This will decrease the vector length by one point. Read more

fn diff_with_start(self) -> VecResult<Self>

Calculates the delta of each elements to its previous element. The first element will remain unchanged. Read more

fn cum_sum(self) -> VecResult<Self>

Calculates the cumulative sum of all elements. This operation undoes the diff_with_startoperation. Read more

fn sqrt(self) -> VecResult<Self>

Gets the square root of all vector elements. Read more

fn square(self) -> VecResult<Self>

Squares all vector elements. Read more

fn root(self, degree: f64) -> VecResult<Self>

Calculates the n-th root of every vector element. Read more

fn power(self, exponent: f64) -> VecResult<Self>

Raises every vector element to the given power. Read more

fn logn(self) -> VecResult<Self>

Calculates the natural logarithm to the base e for every vector element. Read more

fn expn(self) -> VecResult<Self>

Calculates the natural exponential to the base e for every vector element. Read more

fn log_base(self, base: f64) -> VecResult<Self>

Calculates the logarithm to the given base for every vector element. Read more

fn exp_base(self, base: f64) -> VecResult<Self>

Calculates the exponential to the given base for every vector element. Read more

fn sin(self) -> VecResult<Self>

Calculates the sine of each element in radians. Read more

fn cos(self) -> VecResult<Self>

Calculates the cosine of each element in radians. Read more

fn tan(self) -> VecResult<Self>

Calculates the tangent of each element in radians.

fn asin(self) -> VecResult<Self>

Calculates the principal value of the inverse sine of each element in radians.

fn acos(self) -> VecResult<Self>

Calculates the principal value of the inverse cosine of each element in radians.

fn atan(self) -> VecResult<Self>

Calculates the principal value of the inverse tangent of each element in radians.

fn sinh(self) -> VecResult<Self>

Calculates the hyperbolic sine each element in radians.

fn cosh(self) -> VecResult<Self>

Calculates the hyperbolic cosine each element in radians.

fn tanh(self) -> VecResult<Self>

Calculates the hyperbolic tangent each element in radians.

fn asinh(self) -> VecResult<Self>

Calculates the principal value of the inverse hyperbolic sine of each element in radians.

fn acosh(self) -> VecResult<Self>

Calculates the principal value of the inverse hyperbolic cosine of each element in radians.

fn atanh(self) -> VecResult<Self>

Calculates the principal value of the inverse hyperbolic tangent of each element in radians.

fn swap_halves(self) -> VecResult<Self>

This function swaps both halves of the vector. This operation is also called fft shift Use it after a plain_fft to get a spectrum which is centered at 0 Hz. Read more

fn override_data(self, data: &[f64]) -> VecResult<Self>

Overrides the data in the vector with the given data. This may also change the vectors length (however not the allocated length). Read more

fn split_into(&self, targets: &mut [Box<Self>]) -> VoidResult

Splits the vector into several smaller vectors. self.len() must be dividable by targets.len() without a remainder and this conidition must be true too targets.len() > 0. # Failures VecResult may report the following ErrorReason members: Read more

fn merge(self, sources: &[Box<Self>]) -> VecResult<Self>

Merges several vectors into self. All vectors must have the same size and at least one vector must be provided. # Failures VecResult may report the following ErrorReason members: Read more

impl RealVectorOperations<f32> for GenericDataVector<f32>
[src]

type ComplexPartner = Self

fn real_offset(self, offset: f32) -> VecResult<Self>

Adds a scalar to the vector. # Example Read more

fn real_scale(self, factor: f32) -> VecResult<Self>

Multiplies the vector with a scalar. # Example Read more

fn abs(self) -> VecResult<Self>

Gets the absolute value of all vector elements. # Example Read more

fn to_complex(self) -> VecResult<Self>

Converts the real vector into a complex vector. Read more

fn wrap(self, divisor: f32) -> VecResult<Self>

Each value in the vector is devided by the divisor and the remainder is stored in the resulting vector. This the same a modulo operation or to phase wrapping. Read more

fn unwrap(self, divisor: f32) -> VecResult<Self>

This function corrects the jumps in the given vector which occur due to wrap or modulo operations. This will undo a wrap operation only if the deltas are smaller than half the divisor. Read more

fn real_dot_product(&self, factor: &Self) -> ScalarResult<f32>

Calculates the dot product of self and factor. Self and factor remain unchanged. # Failures VecResult may report the following ErrorReason members: Read more

fn real_statistics(&self) -> Statistics<f32>

Calculates the statistics of the data contained in the vector. # Example Read more

fn real_statistics_splitted(&self, len: usize) -> Vec<Statistics<f32>>

Calculates the statistics of the data contained in the vector as if the vector would have been split into len pieces. self.len should be devisable by len without a remainder, but this isn't enforced by the implementation. # Example Read more

impl Scale<f32> for GenericDataVector<f32>
[src]

fn scale(self, offset: f32) -> VecResult<Self>

Multiplies the vector element with a scalar.

impl Offset<f32> for GenericDataVector<f32>
[src]

fn offset(self, offset: f32) -> VecResult<Self>

Adds a scalar to each vector element.

impl RealVectorOperations<f64> for GenericDataVector<f64>
[src]

type ComplexPartner = Self

fn real_offset(self, offset: f64) -> VecResult<Self>

Adds a scalar to the vector. # Example Read more

fn real_scale(self, factor: f64) -> VecResult<Self>

Multiplies the vector with a scalar. # Example Read more

fn abs(self) -> VecResult<Self>

Gets the absolute value of all vector elements. # Example Read more

fn to_complex(self) -> VecResult<Self>

Converts the real vector into a complex vector. Read more

fn wrap(self, divisor: f64) -> VecResult<Self>

Each value in the vector is devided by the divisor and the remainder is stored in the resulting vector. This the same a modulo operation or to phase wrapping. Read more

fn unwrap(self, divisor: f64) -> VecResult<Self>

This function corrects the jumps in the given vector which occur due to wrap or modulo operations. This will undo a wrap operation only if the deltas are smaller than half the divisor. Read more

fn real_dot_product(&self, factor: &Self) -> ScalarResult<f64>

Calculates the dot product of self and factor. Self and factor remain unchanged. # Failures VecResult may report the following ErrorReason members: Read more

fn real_statistics(&self) -> Statistics<f64>

Calculates the statistics of the data contained in the vector. # Example Read more

fn real_statistics_splitted(&self, len: usize) -> Vec<Statistics<f64>>

Calculates the statistics of the data contained in the vector as if the vector would have been split into len pieces. self.len should be devisable by len without a remainder, but this isn't enforced by the implementation. # Example Read more

impl Scale<f64> for GenericDataVector<f64>
[src]

fn scale(self, offset: f64) -> VecResult<Self>

Multiplies the vector element with a scalar.

impl Offset<f64> for GenericDataVector<f64>
[src]

fn offset(self, offset: f64) -> VecResult<Self>

Adds a scalar to each vector element.

impl ComplexVectorOperations<f32> for GenericDataVector<f32>
[src]

type RealPartner = GenericDataVector<f32>

fn complex_data(&self) -> &[Complex<f32>]

Gets self.data() as complex array.

fn complex_offset(self, offset: Complex<f32>) -> VecResult<Self>

Adds a scalar to the vector. # Example Read more

fn complex_scale(self, factor: Complex<f32>) -> VecResult<Self>

Multiplies the vector with a scalar. # Example Read more

fn multiply_complex_exponential(self, a: f32, b: f32) -> VecResult<Self>

Multiplies each vector element with exp(j*(a*idx*self.delta() + b)) where a and b are arguments and idx is the index of the data points in the vector ranging from 0 to self.points() - 1. j is the imaginary number and exp the exponential function. Read more

fn magnitude(self) -> VecResult<Self>

Gets the absolute value or magnitude of all vector elements. # Example Read more

fn get_magnitude(&self, destination: &mut Self) -> VoidResult

Copies the absolute value or magnitude of all vector elements into the given target vector. # Example Read more

fn magnitude_squared(self) -> VecResult<Self>

Gets the square root of the absolute value of all vector elements. # Example Read more

fn complex_conj(self) -> VecResult<Self>

Calculates the complex conjugate of the vector. # Example Read more

fn to_real(self) -> VecResult<Self>

Gets all real elements. # Example Read more

fn to_imag(self) -> VecResult<Self>

Gets all imag elements. # Example Read more

fn get_real(&self, destination: &mut Self) -> VoidResult

Copies all real elements into the given vector. # Example Read more

fn get_imag(&self, destination: &mut Self) -> VoidResult

Copies all imag elements into the given vector. # Example Read more

fn phase(self) -> VecResult<Self>

Gets the phase of all elements in [rad]. # Example Read more

fn get_phase(&self, destination: &mut Self) -> VoidResult

Copies the phase of all elements in [rad] into the given vector. # Example Read more

fn complex_dot_product(&self, factor: &Self) -> ScalarResult<Complex<f32>>

Calculates the dot product of self and factor. Self and factor remain unchanged. # Failures VecResult may report the following ErrorReason members: Read more

fn complex_statistics(&self) -> Statistics<Complex<f32>>

Calculates the statistics of the data contained in the vector. # Example Read more

fn complex_statistics_splitted(&self, len: usize) -> Vec<Statistics<Complex<f32>>>

Calculates the statistics of the data contained in the vector as if the vector would have been split into len pieces. self.len should be devisable by len without a remainder, but this isn't enforced by the implementation. # Example Read more

fn get_real_imag(&self, real: &mut Self::RealPartner, imag: &mut Self::RealPartner) -> VoidResult

Gets the real and imaginary parts and stores them in the given vectors. See get_phase and get_complex_abs for further information. Read more

fn get_mag_phase(&self, mag: &mut Self::RealPartner, phase: &mut Self::RealPartner) -> VoidResult

Gets the magnitude and phase and stores them in the given vectors. See get_real and get_imag for further information. Read more

fn set_real_imag(self, real: &Self::RealPartner, imag: &Self::RealPartner) -> VecResult<Self>

Overrides the self vectors data with the real and imaginary data in the given vectors. real and imag must have the same size. Read more

fn set_mag_phase(self, mag: &Self::RealPartner, phase: &Self::RealPartner) -> VecResult<Self>

Overrides the self vectors data with the magnitude and phase data in the given vectors. Note that self vector will immediately convert the data into a real and imaginary representation of the complex numbers which is its default format. mag and phase must have the same size. Read more

impl Scale<Complex<f32>> for GenericDataVector<f32>
[src]

fn scale(self, offset: Complex<f32>) -> VecResult<Self>

Multiplies the vector element with a scalar.

impl Offset<Complex<f32>> for GenericDataVector<f32>
[src]

fn offset(self, offset: Complex<f32>) -> VecResult<Self>

Adds a scalar to each vector element.

impl ComplexVectorOperations<f64> for GenericDataVector<f64>
[src]

type RealPartner = GenericDataVector<f64>

fn complex_data(&self) -> &[Complex<f64>]

Gets self.data() as complex array.

fn complex_offset(self, offset: Complex<f64>) -> VecResult<Self>

Adds a scalar to the vector. # Example Read more

fn complex_scale(self, factor: Complex<f64>) -> VecResult<Self>

Multiplies the vector with a scalar. # Example Read more

fn multiply_complex_exponential(self, a: f64, b: f64) -> VecResult<Self>

Multiplies each vector element with exp(j*(a*idx*self.delta() + b)) where a and b are arguments and idx is the index of the data points in the vector ranging from 0 to self.points() - 1. j is the imaginary number and exp the exponential function. Read more

fn magnitude(self) -> VecResult<Self>

Gets the absolute value or magnitude of all vector elements. # Example Read more

fn get_magnitude(&self, destination: &mut Self) -> VoidResult

Copies the absolute value or magnitude of all vector elements into the given target vector. # Example Read more

fn magnitude_squared(self) -> VecResult<Self>

Gets the square root of the absolute value of all vector elements. # Example Read more

fn complex_conj(self) -> VecResult<Self>

Calculates the complex conjugate of the vector. # Example Read more

fn to_real(self) -> VecResult<Self>

Gets all real elements. # Example Read more

fn to_imag(self) -> VecResult<Self>

Gets all imag elements. # Example Read more

fn get_real(&self, destination: &mut Self) -> VoidResult

Copies all real elements into the given vector. # Example Read more

fn get_imag(&self, destination: &mut Self) -> VoidResult

Copies all imag elements into the given vector. # Example Read more

fn phase(self) -> VecResult<Self>

Gets the phase of all elements in [rad]. # Example Read more

fn get_phase(&self, destination: &mut Self) -> VoidResult

Copies the phase of all elements in [rad] into the given vector. # Example Read more

fn complex_dot_product(&self, factor: &Self) -> ScalarResult<Complex<f64>>

Calculates the dot product of self and factor. Self and factor remain unchanged. # Failures VecResult may report the following ErrorReason members: Read more

fn complex_statistics(&self) -> Statistics<Complex<f64>>

Calculates the statistics of the data contained in the vector. # Example Read more

fn complex_statistics_splitted(&self, len: usize) -> Vec<Statistics<Complex<f64>>>

Calculates the statistics of the data contained in the vector as if the vector would have been split into len pieces. self.len should be devisable by len without a remainder, but this isn't enforced by the implementation. # Example Read more

fn get_real_imag(&self, real: &mut Self::RealPartner, imag: &mut Self::RealPartner) -> VoidResult

Gets the real and imaginary parts and stores them in the given vectors. See get_phase and get_complex_abs for further information. Read more

fn get_mag_phase(&self, mag: &mut Self::RealPartner, phase: &mut Self::RealPartner) -> VoidResult

Gets the magnitude and phase and stores them in the given vectors. See get_real and get_imag for further information. Read more

fn set_real_imag(self, real: &Self::RealPartner, imag: &Self::RealPartner) -> VecResult<Self>

Overrides the self vectors data with the real and imaginary data in the given vectors. real and imag must have the same size. Read more

fn set_mag_phase(self, mag: &Self::RealPartner, phase: &Self::RealPartner) -> VecResult<Self>

Overrides the self vectors data with the magnitude and phase data in the given vectors. Note that self vector will immediately convert the data into a real and imaginary representation of the complex numbers which is its default format. mag and phase must have the same size. Read more

impl Scale<Complex<f64>> for GenericDataVector<f64>
[src]

fn scale(self, offset: Complex<f64>) -> VecResult<Self>

Multiplies the vector element with a scalar.

impl Offset<Complex<f64>> for GenericDataVector<f64>
[src]

fn offset(self, offset: Complex<f64>) -> VecResult<Self>

Adds a scalar to each vector element.

impl TimeDomainOperations<f32> for GenericDataVector<f32>
[src]

type FreqPartner = GenericDataVector<f32>

fn plain_fft(self) -> VecResult<Self>

Performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector. Read more

fn apply_window(self, window: &WindowFunction<f32>) -> VecResult<Self>

Applies a window to the data vector.

fn unapply_window(self, window: &WindowFunction<f32>) -> VecResult<Self>

Removes a window from the data vector.

fn fft(self) -> VecResult<Self::FreqPartner>

Performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector. # Unstable FFTs of real vectors are unstable. # Example Read more

fn windowed_fft(self, window: &WindowFunction<f32>) -> VecResult<Self::FreqPartner>

Applies a FFT window and performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector. Read more

impl SymmetricTimeDomainOperations<f32> for GenericDataVector<f32>
[src]

type FreqPartner = GenericDataVector<f32>

fn plain_sfft(self) -> VecResult<GenericDataVector<f32>>

Performs a Symmetric Fast Fourier Transformation under the assumption that self is symmetric around the center. This assumption isn't verified and no error is raised if the vector isn't symmetric. Read more

fn sfft(self) -> VecResult<GenericDataVector<f32>>

Performs a Symmetric Fast Fourier Transformation under the assumption that self is symmetric around the center. This assumption isn't verified and no error is raised if the vector isn't symmetric. # Failures VecResult may report the following ErrorReason members: Read more

fn windowed_sfft(self, window: &WindowFunction<f32>) -> VecResult<GenericDataVector<f32>>

Performs a Symmetric Fast Fourier Transformation under the assumption that self is symmetric around the center. This assumption isn't verified and no error is raised if the vector isn't symmetric. # Failures VecResult may report the following ErrorReason members: Read more

impl FrequencyDomainOperations<f32> for GenericDataVector<f32>
[src]

type ComplexTimePartner = GenericDataVector<f32>

fn plain_ifft(self) -> VecResult<GenericDataVector<f32>>

Performs an Inverse Fast Fourier Transformation transforming a frequency domain vector into a time domain vector. Read more

fn mirror(self) -> VecResult<Self>

This function mirrors the spectrum vector to transform a symmetric spectrum into a full spectrum with the DC element at index 0 (no fft shift/swap halves). Read more

fn ifft(self) -> VecResult<Self::ComplexTimePartner>

Performs an Inverse Fast Fourier Transformation transforming a frequency domain vector into a time domain vector. # Example Read more

fn windowed_ifft(self, window: &WindowFunction<f32>) -> VecResult<Self::ComplexTimePartner>

Performs an Inverse Fast Fourier Transformation transforming a frequency domain vector into a time domain vector and removes the FFT window. Read more

fn fft_shift(self) -> VecResult<Self>

Swaps vector halves after a Fourier Transformation.

fn ifft_shift(self) -> VecResult<Self>

Swaps vector halves before an Inverse Fourier Transformation.

impl SymmetricFrequencyDomainOperations<f32> for GenericDataVector<f32>
[src]

type RealTimePartner = GenericDataVector<f32>

fn plain_sifft(self) -> VecResult<GenericDataVector<f32>>

Performs a Symmetric Inverse Fast Fourier Transformation under the assumption that self contains half of a symmetric spectrum starting from 0 Hz. This assumption isn't verified and no error is raised if the spectrum isn't symmetric. The reason for this is that there is no robust verification possible. Read more

fn sifft(self) -> VecResult<Self::RealTimePartner>

Performs a Symmetric Inverse Fast Fourier Transformation under the assumption that self contains half of a symmetric spectrum starting from 0 Hz. This assumption isn't verified and no error is raised if the spectrum isn't symmetric. The reason for this is that there is no robust verification possible. Read more

fn windowed_sifft(self, window: &WindowFunction<f32>) -> VecResult<Self::RealTimePartner>

Performs a Symmetric Inverse Fast Fourier Transformation (SIFFT) and removes the FFT window. The SIFFT is performed under the assumption that self contains half of a symmetric spectrum starting from 0 Hz. This assumption isn't verified and no error is raised if the spectrum isn't symmetric. The reason for this is that there is no robust verification possible. Read more

impl TimeDomainOperations<f64> for GenericDataVector<f64>
[src]

type FreqPartner = GenericDataVector<f64>

fn plain_fft(self) -> VecResult<Self>

Performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector. Read more

fn apply_window(self, window: &WindowFunction<f64>) -> VecResult<Self>

Applies a window to the data vector.

fn unapply_window(self, window: &WindowFunction<f64>) -> VecResult<Self>

Removes a window from the data vector.

fn fft(self) -> VecResult<Self::FreqPartner>

Performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector. # Unstable FFTs of real vectors are unstable. # Example Read more

fn windowed_fft(self, window: &WindowFunction<f64>) -> VecResult<Self::FreqPartner>

Applies a FFT window and performs a Fast Fourier Transformation transforming a time domain vector into a frequency domain vector. Read more

impl SymmetricTimeDomainOperations<f64> for GenericDataVector<f64>
[src]

type FreqPartner = GenericDataVector<f64>

fn plain_sfft(self) -> VecResult<GenericDataVector<f64>>

Performs a Symmetric Fast Fourier Transformation under the assumption that self is symmetric around the center. This assumption isn't verified and no error is raised if the vector isn't symmetric. Read more

fn sfft(self) -> VecResult<GenericDataVector<f64>>

Performs a Symmetric Fast Fourier Transformation under the assumption that self is symmetric around the center. This assumption isn't verified and no error is raised if the vector isn't symmetric. # Failures VecResult may report the following ErrorReason members: Read more

fn windowed_sfft(self, window: &WindowFunction<f64>) -> VecResult<GenericDataVector<f64>>

Performs a Symmetric Fast Fourier Transformation under the assumption that self is symmetric around the center. This assumption isn't verified and no error is raised if the vector isn't symmetric. # Failures VecResult may report the following ErrorReason members: Read more

impl FrequencyDomainOperations<f64> for GenericDataVector<f64>
[src]

type ComplexTimePartner = GenericDataVector<f64>

fn plain_ifft(self) -> VecResult<GenericDataVector<f64>>

Performs an Inverse Fast Fourier Transformation transforming a frequency domain vector into a time domain vector. Read more

fn mirror(self) -> VecResult<Self>

This function mirrors the spectrum vector to transform a symmetric spectrum into a full spectrum with the DC element at index 0 (no fft shift/swap halves). Read more

fn ifft(self) -> VecResult<Self::ComplexTimePartner>

Performs an Inverse Fast Fourier Transformation transforming a frequency domain vector into a time domain vector. # Example Read more

fn windowed_ifft(self, window: &WindowFunction<f64>) -> VecResult<Self::ComplexTimePartner>

Performs an Inverse Fast Fourier Transformation transforming a frequency domain vector into a time domain vector and removes the FFT window. Read more

fn fft_shift(self) -> VecResult<Self>

Swaps vector halves after a Fourier Transformation.

fn ifft_shift(self) -> VecResult<Self>

Swaps vector halves before an Inverse Fourier Transformation.

impl SymmetricFrequencyDomainOperations<f64> for GenericDataVector<f64>
[src]

type RealTimePartner = GenericDataVector<f64>

fn plain_sifft(self) -> VecResult<GenericDataVector<f64>>

Performs a Symmetric Inverse Fast Fourier Transformation under the assumption that self contains half of a symmetric spectrum starting from 0 Hz. This assumption isn't verified and no error is raised if the spectrum isn't symmetric. The reason for this is that there is no robust verification possible. Read more

fn sifft(self) -> VecResult<Self::RealTimePartner>

Performs a Symmetric Inverse Fast Fourier Transformation under the assumption that self contains half of a symmetric spectrum starting from 0 Hz. This assumption isn't verified and no error is raised if the spectrum isn't symmetric. The reason for this is that there is no robust verification possible. Read more

fn windowed_sifft(self, window: &WindowFunction<f64>) -> VecResult<Self::RealTimePartner>

Performs a Symmetric Inverse Fast Fourier Transformation (SIFFT) and removes the FFT window. The SIFFT is performed under the assumption that self contains half of a symmetric spectrum starting from 0 Hz. This assumption isn't verified and no error is raised if the spectrum isn't symmetric. The reason for this is that there is no robust verification possible. Read more

impl<'a> Convolution<f32, &'a RealImpulseResponse<f32>> for GenericDataVector<f32>
[src]

fn convolve(self, function: &RealImpulseResponse<f32>, ratio: f32, len: usize) -> VecResult<Self>

Convolves self with the convolution function impulse_response. For performance consider to to use FrequencyMultiplication instead of this operation depending on len. Read more

impl<'a> Convolution<f32, &'a ComplexImpulseResponse<f32>> for GenericDataVector<f32>
[src]

fn convolve(self, function: &ComplexImpulseResponse<f32>, ratio: f32, len: usize) -> VecResult<Self>

Convolves self with the convolution function impulse_response. For performance consider to to use FrequencyMultiplication instead of this operation depending on len. Read more

impl<'a> FrequencyMultiplication<f32, &'a ComplexFrequencyResponse<f32>> for GenericDataVector<f32>
[src]

fn multiply_frequency_response(self, function: &ComplexFrequencyResponse<f32>, ratio: f32) -> VecResult<Self>

Mutiplies self with the frequency response function frequency_response. Read more

impl<'a> FrequencyMultiplication<f32, &'a RealFrequencyResponse<f32>> for GenericDataVector<f32>
[src]

fn multiply_frequency_response(self, function: &RealFrequencyResponse<f32>, ratio: f32) -> VecResult<Self>

Mutiplies self with the frequency response function frequency_response. Read more

impl VectorConvolution<f32> for GenericDataVector<f32>
[src]

fn convolve_vector(self, vector: &Self) -> VecResult<Self>

Convolves self with the convolution function impulse_response. For performance it's recommended to use multiply both vectors in frequency domain instead of this operation. # Failures VecResult may report the following ErrorReason members: Read more

impl<'a> Convolution<f64, &'a RealImpulseResponse<f64>> for GenericDataVector<f64>
[src]

fn convolve(self, function: &RealImpulseResponse<f64>, ratio: f64, len: usize) -> VecResult<Self>

Convolves self with the convolution function impulse_response. For performance consider to to use FrequencyMultiplication instead of this operation depending on len. Read more

impl<'a> Convolution<f64, &'a ComplexImpulseResponse<f64>> for GenericDataVector<f64>
[src]

fn convolve(self, function: &ComplexImpulseResponse<f64>, ratio: f64, len: usize) -> VecResult<Self>

Convolves self with the convolution function impulse_response. For performance consider to to use FrequencyMultiplication instead of this operation depending on len. Read more

impl<'a> FrequencyMultiplication<f64, &'a ComplexFrequencyResponse<f64>> for GenericDataVector<f64>
[src]

fn multiply_frequency_response(self, function: &ComplexFrequencyResponse<f64>, ratio: f64) -> VecResult<Self>

Mutiplies self with the frequency response function frequency_response. Read more

impl<'a> FrequencyMultiplication<f64, &'a RealFrequencyResponse<f64>> for GenericDataVector<f64>
[src]

fn multiply_frequency_response(self, function: &RealFrequencyResponse<f64>, ratio: f64) -> VecResult<Self>

Mutiplies self with the frequency response function frequency_response. Read more

impl VectorConvolution<f64> for GenericDataVector<f64>
[src]

fn convolve_vector(self, vector: &Self) -> VecResult<Self>

Convolves self with the convolution function impulse_response. For performance it's recommended to use multiply both vectors in frequency domain instead of this operation. # Failures VecResult may report the following ErrorReason members: Read more

impl CrossCorrelation<f32> for GenericDataVector<f32>
[src]

type FreqPartner = Self

fn prepare_argument(self) -> VecResult<Self::FreqPartner>

Prepares an argument to be used for convolution. Preparing an argument includes two steps: Read more

fn prepare_argument_padded(self) -> VecResult<Self::FreqPartner>

Prepares an argument to be used for convolution. The argument is zero padded to length of 2 * self.points() - 1 and then the same operations are performed as described for prepare_argument. Read more

fn correlate(self, other: &Self::FreqPartner) -> VecResult<Self>

Calculates the correlation between self and other. other needs to be a time vector which went through one of the prepare functions prepare_argument or prepare_argument_padded. See also the trait description for more details. Read more

impl CrossCorrelation<f64> for GenericDataVector<f64>
[src]

type FreqPartner = Self

fn prepare_argument(self) -> VecResult<Self::FreqPartner>

Prepares an argument to be used for convolution. Preparing an argument includes two steps: Read more

fn prepare_argument_padded(self) -> VecResult<Self::FreqPartner>

Prepares an argument to be used for convolution. The argument is zero padded to length of 2 * self.points() - 1 and then the same operations are performed as described for prepare_argument. Read more

fn correlate(self, other: &Self::FreqPartner) -> VecResult<Self>

Calculates the correlation between self and other. other needs to be a time vector which went through one of the prepare functions prepare_argument or prepare_argument_padded. See also the trait description for more details. Read more

impl Interpolation<f32> for GenericDataVector<f32>
[src]

fn interpolatef(self, function: &RealImpulseResponse<f32>, interpolation_factor: f32, delay: f32, 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(). Read more

fn interpolatei(self, function: &RealFrequencyResponse<f32>, 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. Read more

fn decimatei(self, decimation_factor: u32, delay: u32) -> VecResult<Self>

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

impl RealInterpolation<f32> for GenericDataVector<f32>
[src]

fn interpolate_lin(self, interpolation_factor: f32, delay: f32) -> VecResult<Self>

Linear interpolation between samples. # Unstable This operation and interpolate_hermite might be merged into one function with an additional argument in future. Read more

fn interpolate_hermite(self, interpolation_factor: f32, delay: f32) -> VecResult<Self>

Piecewise cubic hermite interpolation between samples. # Unstable Algorithm might need to be revised. This operation and interpolate_lin might be merged into one function with an additional argument in future. Read more

impl Interpolation<f64> for GenericDataVector<f64>
[src]

fn interpolatef(self, function: &RealImpulseResponse<f64>, interpolation_factor: f64, delay: f64, 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(). Read more

fn interpolatei(self, function: &RealFrequencyResponse<f64>, 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. Read more

fn decimatei(self, decimation_factor: u32, delay: u32) -> VecResult<Self>

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

impl RealInterpolation<f64> for GenericDataVector<f64>
[src]

fn interpolate_lin(self, interpolation_factor: f64, delay: f64) -> VecResult<Self>

Linear interpolation between samples. # Unstable This operation and interpolate_hermite might be merged into one function with an additional argument in future. Read more

fn interpolate_hermite(self, interpolation_factor: f64, delay: f64) -> VecResult<Self>

Piecewise cubic hermite interpolation between samples. # Unstable Algorithm might need to be revised. This operation and interpolate_lin might be merged into one function with an additional argument in future. Read more

impl<T: Debug> Debug for GenericDataVector<T> where T: RealNumber
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T> DataVector<T> for GenericDataVector<T> where T: RealNumber
[src]

fn len(&self) -> usize

The number of valid elements in the the vector.

fn set_len(&mut self, len: usize)

Sets the vector length to the given length. If self.len() < len then the value of the new elements is undefined. Read more

fn allocated_len(&self) -> usize

Gets the number of allocated elements in the underlying vector. The allocated length may be larger than the length of valid points. In most cases you likely want to have lenor points instead. Read more

fn data(&self) -> &[T]

Gives direct access to the underlying data sequence. It's recommended to use the `Index functions . For users outside of Rust: It's discouraged to hold references to this array while executing operations on the vector, since the vector may decide at any operation to invalidate the array. Read more

fn delta(&self) -> T

The x-axis delta. If domain is time domain then delta is in [s], in frequency domain delta is in [Hz].

fn domain(&self) -> DataVectorDomain

The domain in which the data vector resides. Basically specifies the x-axis and the type of operations which are valid on this vector. Read more

fn is_complex(&self) -> bool

Indicates whether the vector contains complex data. This also specifies the type of operations which are valid on this vector. Read more

fn points(&self) -> usize

The number of valid points. If the vector is complex then every valid point consists of two floating point numbers, while for real vectors every point only consists of one floating point number. Read more

impl<T> RededicateVector<T> for GenericDataVector<T> where T: RealNumber
[src]

fn rededicate_as_complex_time_vector(self, delta: T) -> ComplexTimeVector<T>

Make self a complex time vector # Example Read more

fn rededicate_as_complex_freq_vector(self, delta: T) -> ComplexFreqVector<T>

Make self a complex frequency vector

fn rededicate_as_real_time_vector(self, delta: T) -> RealTimeVector<T>

Make self a real time vector

fn rededicate_as_real_freq_vector(self, delta: T) -> RealFreqVector<T>

Make self a real freq vector

fn rededicate_as_generic_vector(self, is_complex: bool, domain: DataVectorDomain, delta: T) -> GenericDataVector<T>

Make self a generic vector

impl<T> Index<usize> for GenericDataVector<T> where T: RealNumber
[src]

type Output = T

The returned type after indexing

fn index(&self, index: usize) -> &T

The method for the indexing (Foo[Bar]) operation

impl<T> IndexMut<usize> for GenericDataVector<T> where T: RealNumber
[src]

fn index_mut(&mut self, index: usize) -> &mut T

The method for the indexing (Foo[Bar]) operation

impl<T> Index<Range<usize>> for GenericDataVector<T> where T: RealNumber
[src]

type Output = [T]

The returned type after indexing

fn index(&self, index: Range<usize>) -> &[T]

The method for the indexing (Foo[Bar]) operation

impl<T> IndexMut<Range<usize>> for GenericDataVector<T> where T: RealNumber
[src]

fn index_mut(&mut self, index: Range<usize>) -> &mut [T]

The method for the indexing (Foo[Bar]) operation

impl<T> Index<RangeFrom<usize>> for GenericDataVector<T> where T: RealNumber
[src]

type Output = [T]

The returned type after indexing

fn index(&self, index: RangeFrom<usize>) -> &[T]

The method for the indexing (Foo[Bar]) operation

impl<T> IndexMut<RangeFrom<usize>> for GenericDataVector<T> where T: RealNumber
[src]

fn index_mut(&mut self, index: RangeFrom<usize>) -> &mut [T]

The method for the indexing (Foo[Bar]) operation

impl<T> Index<RangeTo<usize>> for GenericDataVector<T> where T: RealNumber
[src]

type Output = [T]

The returned type after indexing

fn index(&self, index: RangeTo<usize>) -> &[T]

The method for the indexing (Foo[Bar]) operation

impl<T> IndexMut<RangeTo<usize>> for GenericDataVector<T> where T: RealNumber
[src]

fn index_mut(&mut self, index: RangeTo<usize>) -> &mut [T]

The method for the indexing (Foo[Bar]) operation

impl<T> Index<RangeFull> for GenericDataVector<T> where T: RealNumber
[src]

type Output = [T]

The returned type after indexing

fn index(&self, index: RangeFull) -> &[T]

The method for the indexing (Foo[Bar]) operation

impl<T> IndexMut<RangeFull> for GenericDataVector<T> where T: RealNumber
[src]

fn index_mut(&mut self, index: RangeFull) -> &mut [T]

The method for the indexing (Foo[Bar]) operation

impl<T> Clone for GenericDataVector<T> where T: RealNumber
[src]

fn clone(&self) -> Self

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more