Trait basic_dsp_vector::ElementaryWrapAroundOps
[−]
[src]
pub trait ElementaryWrapAroundOps<A> {
fn add_smaller(&mut self, summand: &A) -> VoidResult;
fn sub_smaller(&mut self, summand: &A) -> VoidResult;
fn mul_smaller(&mut self, factor: &A) -> VoidResult;
fn div_smaller(&mut self, divisor: &A) -> VoidResult;
}
Required Methods
fn add_smaller(&mut self, summand: &A) -> VoidResult
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
TransRes may report the following ErrorReason members:
InvalidArgumentLength:self.points()isn't dividable bysummand.points()VectorMetaDataMustAgree:selfandsummandmust be in the same domain and number space
Example
use basic_dsp_vector::*; let mut vector1 = vec!(10.0, 11.0, 12.0, 13.0).to_real_time_vec(); let vector2 = vec!(1.0, 2.0).to_real_time_vec(); vector1.add_smaller(&vector2).expect("Ignoring error handling in examples"); assert_eq!([11.0, 13.0, 13.0, 15.0], vector1[0..]);Run
fn sub_smaller(&mut self, summand: &A) -> VoidResult
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
TransRes may report the following ErrorReason members:
InvalidArgumentLength:self.points()isn't dividable bysubtrahend.points()VectorMetaDataMustAgree:selfandsubtrahendmust be in the same domain and number space
Example
use basic_dsp_vector::*; let mut vector1 = vec!(10.0, 11.0, 12.0, 13.0).to_real_time_vec(); let vector2 = vec!(1.0, 2.0).to_real_time_vec(); vector1.sub_smaller(&vector2).expect("Ignoring error handling in examples"); assert_eq!([9.0, 9.0, 11.0, 11.0], vector1[0..]);Run
fn mul_smaller(&mut self, factor: &A) -> VoidResult
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
TransRes may report the following ErrorReason members:
InvalidArgumentLength:self.points()isn't dividable byfactor.points()VectorMetaDataMustAgree:selfandfactormust be in the same domain and number space
Example
use basic_dsp_vector::*; let mut vector1 = vec!(10.0, 11.0, 12.0, 13.0).to_real_time_vec(); let vector2 = vec!(1.0, 2.0).to_real_time_vec(); vector1.mul_smaller(&vector2).expect("Ignoring error handling in examples"); assert_eq!([10.0, 22.0, 12.0, 26.0], vector1[0..]);Run
fn div_smaller(&mut self, divisor: &A) -> VoidResult
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
TransRes may report the following ErrorReason members:
InvalidArgumentLength:self.points()isn't dividable bydivisor.points()VectorMetaDataMustAgree:selfanddivisormust be in the same domain and number space
Example
use basic_dsp_vector::*; let mut vector1 = vec!(10.0, 12.0, 12.0, 14.0).to_real_time_vec(); let vector2 = vec!(1.0, 2.0).to_real_time_vec(); vector1.div_smaller(&vector2).expect("Ignoring error handling in examples"); assert_eq!([10.0, 6.0, 12.0, 7.0], vector1[0..]);Run
Implementors
impl<S, T, N, D> ElementaryWrapAroundOps<DspVec<S, T, N, D>> for DspVec<S, T, N, D> where S: ToSliceMut<T>, T: RealNumber, N: NumberSpace, D: Domain