[−][src]Trait basic_dsp_vector::ComplexToRealGetterOps
Defines getters to get real data from complex types.
Failures
All operations in this trait set the arguments len()
to 0
if the type isn't in
the complex number space.
Required methods
fn get_real(&self, destination: &mut A)
Copies all real elements into the given vector.
Example
use basic_dsp_vector::*; let vector = vec!(1.0, 2.0, 3.0, 4.0).to_complex_time_vec(); let mut target = Vec::new().to_real_time_vec(); vector.get_real(&mut target); assert_eq!([1.0, 3.0], target[..]);
fn get_imag(&self, destination: &mut A)
Copies all imag elements into the given vector.
Example
use basic_dsp_vector::*; let vector = vec!(1.0, 2.0, 3.0, 4.0).to_complex_time_vec(); let mut target = Vec::new().to_real_time_vec(); vector.get_imag(&mut target); assert_eq!([2.0, 4.0], target[..]);
fn get_magnitude(&self, destination: &mut A)
Copies the absolute value or magnitude of all vector elements into the given target vector.
Example
use basic_dsp_vector::*; let vector = vec!(3.0, -4.0, -3.0, 4.0).to_complex_time_vec(); let mut target = Vec::new().to_real_time_vec(); vector.get_magnitude(&mut target); assert_eq!([5.0, 5.0], target[..]);
fn get_magnitude_squared(&self, destination: &mut A)
Copies the absolute value squared or magnitude squared of all vector elements into the given target vector.
Example
Copies the absolute value or magnitude of all vector elements into the given target vector.
Example
use basic_dsp_vector::*; let vector = vec!(3.0, -4.0, -3.0, 4.0).to_complex_time_vec(); let mut target = Vec::new().to_real_time_vec(); vector.get_magnitude_squared(&mut target); assert_eq!([25.0, 25.0], target[..]);
fn get_phase(&self, destination: &mut A)
Copies the phase of all elements in [rad] into the given vector.
Example
use basic_dsp_vector::*; let vector = vec!(1.0, 0.0, 0.0, 4.0, -2.0, 0.0, 0.0, -3.0, 1.0, 1.0).to_complex_time_vec(); let mut target = Vec::new().to_real_time_vec(); vector.get_phase(&mut target); let actual = &target[..]; let expected = &[0.0, 1.5707964, 3.1415927, -1.5707964, 0.7853982]; assert_eq!(actual.len(), expected.len()); for i in 0..actual.len() { assert!(f64::abs(actual[i] - expected[i]) < 1e-4); }
fn get_real_imag(&self, real: &mut A, imag: &mut A)
Gets the real and imaginary parts and stores them in the given vectors.
See also get_phase
and
get_complex_abs
for further
information.
fn get_mag_phase(&self, mag: &mut A, phase: &mut A)
Implementors
impl<S, T, N, NR, D, O, DO> ComplexToRealGetterOps<O, T, NR, DO> for DspVec<S, T, N, D> where
DspVec<S, T, N, D>: ToRealResult,
O: Vector<T> + GetMetaData<T, NR, DO> + Index<Range<usize>, Output = [T]> + IndexMut<Range<usize>>,
S: ToSlice<T>,
T: RealNumber,
N: ComplexNumberSpace,
NR: RealNumberSpace,
D: Domain,
DO: PosEq<D> + Domain,
[src]
impl<S, T, N, NR, D, O, DO> ComplexToRealGetterOps<O, T, NR, DO> for DspVec<S, T, N, D> where
DspVec<S, T, N, D>: ToRealResult,
O: Vector<T> + GetMetaData<T, NR, DO> + Index<Range<usize>, Output = [T]> + IndexMut<Range<usize>>,
S: ToSlice<T>,
T: RealNumber,
N: ComplexNumberSpace,
NR: RealNumberSpace,
D: Domain,
DO: PosEq<D> + Domain,
fn get_real(&self, destination: &mut O) | [src] |
fn get_imag(&self, destination: &mut O) | [src] |
fn get_magnitude(&self, destination: &mut O) | [src] |
fn get_magnitude_squared(&self, destination: &mut O) | [src] |
fn get_phase(&self, destination: &mut O) | [src] |
fn get_real_imag(&self, real: &mut O, imag: &mut O) | [src] |
fn get_mag_phase(&self, mag: &mut O, phase: &mut O) | [src] |