Struct LowpassOracle

Source
pub struct LowpassOracle {
    pub more_alt: bool,
    pub idx1: i32,
    pub spectrum: Vec<Array1<f64>>,
    pub nwpass: i32,
    pub nwstop: i32,
    pub lp_sq: f64,
    pub up_sq: f64,
    pub sp_sq: f64,
    pub idx2: i32,
    pub idx3: i32,
    pub fmax: f64,
    pub kmax: i32,
}
Expand description

The LowpassOracle struct in Rust represents a lowpass filter with various configuration parameters.

Properties:

  • more_alt: The more_alt property is a boolean flag indicating whether there are more alternative options available.
  • idx1: The idx1 property in the LowpassOracle struct is of type i32.
  • spectrum: The spectrum property is a vector of type Arr.
  • nwpass: The nwpass property in the LowpassOracle struct represents the number of points in the passband of a lowpass filter.
  • nwstop: The nwstop property in the LowpassOracle struct represents the number of points in the stopband of a lowpass filter. It is used to determine the characteristics of the filter, specifically the stopband width.
  • lp_sq: The lp_sq property in the LowpassOracle struct appears to be a floating-point number (f64). It likely represents a squared value used in low-pass filtering calculations or operations.
  • up_sq: The up_sq property in the LowpassOracle struct appears to be a floating-point number of type f64.
  • sp_sq: The sp_sq property in the LowpassOracle struct represents a floating-point value of type f64.
  • idx2: The idx2 property in the LowpassOracle struct appears to be a i32 type. It is a field that holds an unsigned integer value representing an index or position within the context of the struct.
  • idx3: The idx3 property in the LowpassOracle struct represents an unsigned integer value.
  • fmax: The fmax property in the LowpassOracle struct represents the maximum frequency value.
  • kmax: The kmax property in the LowpassOracle struct represents the maximum value for a specific type i32. It is used to store the maximum value for a certain index or count within the context of the LowpassOracle struct.

Fields§

§more_alt: bool§idx1: i32§spectrum: Vec<Array1<f64>>§nwpass: i32§nwstop: i32§lp_sq: f64§up_sq: f64§sp_sq: f64§idx2: i32§idx3: i32§fmax: f64§kmax: i32

Implementations§

Source§

impl LowpassOracle

Source

pub fn new( ndim: usize, wpass: f64, wstop: f64, lp_sq: f64, up_sq: f64, sp_sq: f64, ) -> Self

The new function in Rust initializes a struct with specified parameters for spectral analysis.

Arguments:

  • ndim: ndim represents the number of dimensions for the filter design.
  • wpass: The wpass parameter represents the passband edge frequency in the provided function.
  • wstop: The wstop parameter represents the stopband edge frequency in the given function.
  • lp_sq: The lp_sq parameter in the code represents the lower passband squared value. It is used in the initialization of the struct and is a floating-point number (f64) passed as an argument to the new function.
  • up_sq: The up_sq parameter in the function represents the upper bound squared value for the filter design. It is used in the calculation and initialization of the struct fields in the function.
  • sp_sq: The sp_sq parameter in the new function represents the square of the stopband ripple level in the spectral domain. It is used in digital signal processing to define the desired characteristics of a filter, specifically in this context for designing a filter with given passband and stopband specifications.

Returns:

The new function is returning an instance of the struct that it belongs to. The struct contains several fields such as more_alt, idx1, spectrum, nwpass, nwstop, lp_sq, up_sq, sp_sq, idx2, idx3, fmax, and kmax. The function initializes these fields with the

Trait Implementations§

Source§

impl OracleFeas<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for LowpassOracle

Source§

fn assess_feas(&mut self, x: &Array1<f64>) -> Option<Cut>

The assess_feas function in Rust assesses the feasibility of a given array x based on certain conditions and returns a corresponding Cut option.

Arguments:

  • x: The x parameter in the assess_feas function is an array (Arr) that is passed by reference (&). It is used to perform calculations and comparisons with the elements of the spectrum array in the function.

Returns:

The function assess_feas returns an Option containing a tuple of type Cut. The Cut tuple consists of two elements: a vector of coefficients (Arr) and a tuple of two optional values. The first optional value represents the violation amount if the constraint is violated, and the second optional value represents the amount to reach feasibility if the constraint is infeasible.

Source§

type CutChoice = (f64, Option<f64>)

Source§

impl OracleOptim<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for LowpassOracle

Source§

fn assess_optim(&mut self, x: &Array1<f64>, sp_sq: &mut f64) -> (Cut, bool)

The function assess_optim takes in parameters x and sp_sq, updates the value of sp_sq, assesses feasibility of x, and returns a tuple containing a cut and a boolean value.

Arguments:

  • x: The x parameter is of type Arr, which is likely an array or a slice of some kind. It is passed by reference to the assess_optim function.
  • sp_sq: The sp_sq parameter in the assess_optim function is a mutable reference to a f64 value. This parameter is updated within the function and its value is used to determine the return values of the function.
Source§

type CutChoice = (f64, Option<f64>)

Auto Trait Implementations§

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>,

Source§

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>,

Source§

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.