pub struct Dsm<const K: usize> { /* private fields */ }
Expand description
Delta-sigma modulator
- MASH-(1)^K architecture
0 <= K <= 8
(K=0
is valid but the output will be the constant quantized 0)- The output range is
1 - (1 << K - 1)..=(1 << K - 1)
. - Given constant input
x0
, the average output isx0/(1 << 32)
. - The noise goes up as
K * 20 dB/decade
.
let mut d = Dsm::<3>::default();
let x = 0x87654321;
let n = 1 << 20;
let y = (0..n).map(|_| d.update(x) as f32).sum::<f32>() / n as f32;
let m = x as f32 / (1u64 << 32) as f32;
assert!((y / m - 1.0).abs() < (1.0 / n as f32).sqrt(), "{y} != {m}");
Implementations§
Trait Implementations§
source§impl<const K: usize> PartialOrd for Dsm<K>
impl<const K: usize> PartialOrd for Dsm<K>
impl<const K: usize> Copy for Dsm<K>
impl<const K: usize> Eq for Dsm<K>
impl<const K: usize> StructuralPartialEq for Dsm<K>
Auto Trait Implementations§
impl<const K: usize> Freeze for Dsm<K>
impl<const K: usize> RefUnwindSafe for Dsm<K>
impl<const K: usize> Send for Dsm<K>
impl<const K: usize> Sync for Dsm<K>
impl<const K: usize> Unpin for Dsm<K>
impl<const K: usize> UnwindSafe for Dsm<K>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)