Trait basic_dsp_vector::combined_ops::IdentifierOps [] [src]

pub trait IdentifierOps {
    fn domain(&self) -> DataDomain;
    fn is_complex(&self) -> bool;
    fn clone_from(&mut self, source: &Self);
    fn add_points(&mut self);
    fn sub_points(&mut self);
    fn div_points(&mut self);
    fn mul_points(&mut self);
}

Operations for all kind of vectors which can be used in combination with multi ops or prepared ops.

Required Methods

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

The domain can be changed using the RededicateOps trait.

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

The number space can be changed using the RededicateOps trait.

Copies data from another vector.

Adds its length to the vector elements

Example

use basic_dsp_vector::*;
use basic_dsp_vector::combined_ops::*;
let complex = vec!(1.0, 2.0, 3.0, 4.0).to_complex_time_vec();
let ops = multi_ops1(complex);
let ops = ops.add_ops(|mut v| {
    v.add_points();
    v
});
let mut buffer = SingleBuffer::new();
let complex = ops.get(&mut buffer).expect("Ignoring error handling in examples");
assert_eq!([3.0, 2.0, 5.0, 4.0], &complex[..]);

Subtracts its length from the vector elements

Example

use basic_dsp_vector::*;
use basic_dsp_vector::combined_ops::*;
let complex = vec!(3.0, 2.0, 5.0, 4.0).to_complex_time_vec();
let ops = multi_ops1(complex);
let ops = ops.add_ops(|mut v| {
    v.sub_points();
    v
});
let mut buffer = SingleBuffer::new();
let complex = ops.get(&mut buffer).expect("Ignoring error handling in examples");
assert_eq!([1.0, 2.0, 3.0, 4.0], &complex[..]);

divides the vector elements by its length Subtracts its length from the vector elements

Example

use basic_dsp_vector::*;
use basic_dsp_vector::combined_ops::*;
let complex = vec!(2.0, 4.0, 6.0, 8.0).to_complex_time_vec();
let ops = multi_ops1(complex);
let ops = ops.add_ops(|mut v| {
    v.div_points();
    v
});
let mut buffer = SingleBuffer::new();
let complex = ops.get(&mut buffer).expect("Ignoring error handling in examples");
assert_eq!([1.0, 2.0, 3.0, 4.0], &complex[..]);

Multiplies the vector elements with its length

Example

use basic_dsp_vector::*;
use basic_dsp_vector::combined_ops::*;
let complex = vec!(1.0, 2.0, 3.0, 4.0).to_complex_time_vec();
let ops = multi_ops1(complex);
let ops = ops.add_ops(|mut v| {
    v.mul_points();
    v
});
let mut buffer = SingleBuffer::new();
let complex = ops.get(&mut buffer).expect("Ignoring error handling in examples");
assert_eq!([2.0, 4.0, 6.0, 8.0], &complex[..]);

Implementors