Skip to content

Commit

Permalink
Update docstrings #7
Browse files Browse the repository at this point in the history
  • Loading branch information
jurihock committed Jun 23, 2023
1 parent a2e047f commit 82e0e14
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ impl<T, F> QDFT<T, F>

pub fn size(&self) -> usize { self.size }

/// Estimate the DFT vector for the given sample.
pub fn qdft_scalar(&mut self, sample: &T, dft: &mut [Complex::<F>]) {
assert_eq!(dft.len(), self.size);

Expand Down Expand Up @@ -232,6 +233,7 @@ impl<T, F> QDFT<T, F>
}
}

/// Synthesize the sample from the given DFT vector.
pub fn iqdft_scalar(&mut self, dft: &[Complex::<F>], sample: &mut T) {
assert_eq!(dft.len(), self.size);

Expand All @@ -252,6 +254,7 @@ impl<T, F> QDFT<T, F>
*sample = T::cast(result);
}

/// Estimate the DFT matrix for the given sample array.
#[inline]
pub fn qdft_vector(&mut self, samples: &[T], dfts: &mut [Complex::<F>]) {
assert_eq!(dfts.len(), samples.len() * self.size);
Expand All @@ -261,6 +264,7 @@ impl<T, F> QDFT<T, F>
}
}

/// Synthesize the sample array from the given DFT matrix.
#[inline]
pub fn iqdft_vector(&mut self, dfts: &[Complex::<F>], samples: &mut [T]) {
assert_eq!(dfts.len(), samples.len() * self.size);
Expand All @@ -270,11 +274,15 @@ impl<T, F> QDFT<T, F>
}
}

/// Estimate the DFT matrix for the given sample array.
/// This is a shortcut for the function [`qdft_vector`].
#[inline]
pub fn qdft(&mut self, samples: &[T], dfts: &mut [Complex::<F>]) {
self.qdft_vector(samples, dfts);
}

/// Synthesize the sample array from the given DFT matrix.
/// This is a shortcut for the function [`iqdft_vector`].
#[inline]
pub fn iqdft(&mut self, dfts: &[Complex::<F>], samples: &mut [T]) {
self.iqdft_vector(dfts, samples);
Expand Down

0 comments on commit 82e0e14

Please sign in to comment.