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: Themore_altproperty is a boolean flag indicating whether there are more alternative options available.idx1: Theidx1property in theLowpassOraclestruct is of typei32.spectrum: Thespectrumproperty is a vector of typeArr.nwpass: Thenwpassproperty in theLowpassOraclestruct represents the number of points in the passband of a lowpass filter.nwstop: Thenwstopproperty in theLowpassOraclestruct 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: Thelp_sqproperty in theLowpassOraclestruct appears to be a floating-point number (f64). It likely represents a squared value used in low-pass filtering calculations or operations.up_sq: Theup_sqproperty in theLowpassOraclestruct appears to be a floating-point number of typef64.sp_sq: Thesp_sqproperty in theLowpassOraclestruct represents a floating-point value of typef64.idx2: Theidx2property in theLowpassOraclestruct appears to be ai32type. It is a field that holds an unsigned integer value representing an index or position within the context of the struct.idx3: Theidx3property in theLowpassOraclestruct represents an unsigned integer value.fmax: Thefmaxproperty in theLowpassOraclestruct represents the maximum frequency value.kmax: Thekmaxproperty in theLowpassOraclestruct represents the maximum value for a specific typei32. It is used to store the maximum value for a certain index or count within the context of theLowpassOraclestruct.
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: i32Implementations§
Source§impl LowpassOracle
impl LowpassOracle
Sourcepub fn new(
ndim: usize,
wpass: f64,
wstop: f64,
lp_sq: f64,
up_sq: f64,
sp_sq: f64,
) -> Self
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:ndimrepresents the number of dimensions for the filter design.wpass: Thewpassparameter represents the passband edge frequency in the provided function.wstop: Thewstopparameter represents the stopband edge frequency in the given function.lp_sq: Thelp_sqparameter 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 thenewfunction.up_sq: Theup_sqparameter 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: Thesp_sqparameter in thenewfunction 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
impl OracleFeas<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for LowpassOracle
Source§fn assess_feas(&mut self, x: &Array1<f64>) -> Option<Cut>
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: Thexparameter in theassess_feasfunction is an array (Arr) that is passed by reference (&). It is used to perform calculations and comparisons with the elements of thespectrumarray 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.
type CutChoice = (f64, Option<f64>)
Source§impl OracleOptim<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for LowpassOracle
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)
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: Thexparameter is of typeArr, which is likely an array or a slice of some kind. It is passed by reference to theassess_optimfunction.sp_sq: Thesp_sqparameter in theassess_optimfunction is a mutable reference to af64value. This parameter is updated within the function and its value is used to determine the return values of the function.