Trait idsp::Coefficient
source · pub trait Coefficient:
'static
+ Copy
+ Num
+ AsPrimitive<Self::ACCU> {
type ACCU: AsPrimitive<Self> + Num;
const ONE: Self;
const NEG_ONE: Self;
const ZERO: Self;
const MIN: Self;
const MAX: Self;
// Required methods
fn macc(self, s: Self::ACCU, min: Self, max: Self, e1: Self) -> (Self, Self);
fn clip(self, min: Self, max: Self) -> Self;
fn mul_scaled(self, other: Self) -> Self;
fn div_scaled(self, other: Self) -> Self;
fn quantize<C>(value: C) -> Self
where Self: AsPrimitive<C>,
C: Float + AsPrimitive<Self>;
}
Expand description
Helper trait unifying fixed point and floating point coefficients/samples
Required Associated Types§
sourcetype ACCU: AsPrimitive<Self> + Num
type ACCU: AsPrimitive<Self> + Num
Accumulator type
Required Associated Constants§
Required Methods§
sourcefn macc(self, s: Self::ACCU, min: Self, max: Self, e1: Self) -> (Self, Self)
fn macc(self, s: Self::ACCU, min: Self, max: Self, e1: Self) -> (Self, Self)
Proper scaling and potentially using a wide accumulator.
Clamp self
such that min <= self <= max
.
Undefined result if max < min
.
sourcefn clip(self, min: Self, max: Self) -> Self
fn clip(self, min: Self, max: Self) -> Self
Clamp to between min and max
Undefined if min > max
.
sourcefn mul_scaled(self, other: Self) -> Self
fn mul_scaled(self, other: Self) -> Self
Multiplication (scaled)
sourcefn div_scaled(self, other: Self) -> Self
fn div_scaled(self, other: Self) -> Self
Division (scaled)
Object Safety§
This trait is not object safe.