Struct pm_remez::PMParameters

source ·
pub struct PMParameters<T, D, W> { /* private fields */ }
Expand description

Parks-McClellan design parameters struct.

This struct is one of the two ways (together with the pm_parameters function used with a list of BandSetting objects) in which the parameters to execute the Parks-McClellan algorithm can be designed. This struct specifies custom closures for the desired response and weight function, represented by the type parameters D and W. The type parameter T is the scalar type used for computation. Typically it should implement the Float and FloatConst traits.

Implementations§

source§

impl<T: Float, D, W> PMParameters<T, D, W>

source

pub fn new( num_taps: usize, bands: Vec<Band<T>>, desired_response: D, weights: W ) -> Result<Self>

Creates new design parameters for the Parks-McClellan algorithm.

The num_taps argument indicates the number of taps of the FIR filter. The bands argument is the list of sub-bands of the interval [0.0, 0.5] on which the maximum weighted error is minimized. The desired_response and weight arguments indicate the desired response and weight function of the filter. Typically these should be closures Fn(T) -> T.

Other parameters required for the Parks-McClellan algorithm are given default values and can be changed using the methods defined by the ParametersBuilder trait. By default, the symmetry of the FIR filter taps is set to even, and the other parameters that can be changed by this trait are given reasonable default values.

Trait Implementations§

source§

impl<T, D, W> DesignParameters<T> for PMParameters<T, D, W>
where T: Copy, D: Fn(T) -> T, W: Fn(T) -> T,

source§

fn num_taps(&self) -> usize

Returns the number of taps. Read more
source§

fn bands(&self) -> &[Band<T>]

Returns the list of bands. Read more
source§

fn symmetry(&self) -> Symmetry

Returns the symmetry of the FIR filter taps. Read more
source§

fn desired_response(&self) -> impl Fn(T) -> T

Returns the desired response. Read more
source§

fn weights(&self) -> impl Fn(T) -> T

Returns the weight function. Read more
source§

fn chebyshev_proxy_degree(&self) -> usize

Returns the degree of the Chebyshev proxy that is used for Chebyshev proxy root finding. Read more
source§

fn max_iterations(&self) -> usize

Returns the maximum number of Remez exchange iterations to be performed by pm_remez.
source§

fn flatness_threshold(&self) -> T

Returns the flatness threshold to be used to stop the Remez exchange before the maximum number of iterations is reached. Read more
source§

impl<T, D, W> ParametersBuilder<T> for PMParameters<T, D, W>
where T: Copy, D: Fn(T) -> T, W: Fn(T) -> T,

source§

fn set_symmetry(&mut self, symmetry: Symmetry) -> &mut Self

Sets the symmetry of the FIR filter taps. Read more
source§

fn set_chebyshev_proxy_degree(&mut self, degree: usize) -> &mut Self

Returns the degree of the Chebyshev proxy that is used for Chebyshev proxy root finding. Read more
source§

fn set_max_iterations(&mut self, max_iterations: usize) -> &mut Self

Sets the maximum number of Remez exchange iterations to be performed by pm_remez.
source§

fn set_flatness_threshold(&mut self, flatness_threshold: T) -> &mut Self

Returns the flatness threshold to be used to stop the Remez exchange before the maximum number of iterations is reached. Read more

Auto Trait Implementations§

§

impl<T, D, W> Freeze for PMParameters<T, D, W>
where D: Freeze, W: Freeze, T: Freeze,

§

impl<T, D, W> RefUnwindSafe for PMParameters<T, D, W>

§

impl<T, D, W> Send for PMParameters<T, D, W>
where D: Send, W: Send, T: Send,

§

impl<T, D, W> Sync for PMParameters<T, D, W>
where D: Sync, W: Sync, T: Sync,

§

impl<T, D, W> Unpin for PMParameters<T, D, W>
where D: Unpin, W: Unpin, T: Unpin,

§

impl<T, D, W> UnwindSafe for PMParameters<T, D, W>
where D: UnwindSafe, W: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V