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_alt
property is a boolean flag indicating whether there are more alternative options available.idx1
: Theidx1
property in theLowpassOracle
struct is of typei32
.spectrum
: Thespectrum
property is a vector of typeArr
.nwpass
: Thenwpass
property in theLowpassOracle
struct represents the number of points in the passband of a lowpass filter.nwstop
: Thenwstop
property in theLowpassOracle
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
: Thelp_sq
property in theLowpassOracle
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
: Theup_sq
property in theLowpassOracle
struct appears to be a floating-point number of typef64
.sp_sq
: Thesp_sq
property in theLowpassOracle
struct represents a floating-point value of typef64
.idx2
: Theidx2
property in theLowpassOracle
struct appears to be ai32
type. It is a field that holds an unsigned integer value representing an index or position within the context of the struct.idx3
: Theidx3
property in theLowpassOracle
struct represents an unsigned integer value.fmax
: Thefmax
property in theLowpassOracle
struct represents the maximum frequency value.kmax
: Thekmax
property in theLowpassOracle
struct 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 theLowpassOracle
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
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
:ndim
represents the number of dimensions for the filter design.wpass
: Thewpass
parameter represents the passband edge frequency in the provided function.wstop
: Thewstop
parameter represents the stopband edge frequency in the given function.lp_sq
: Thelp_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 thenew
function.up_sq
: Theup_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
: Thesp_sq
parameter in thenew
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
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
: Thex
parameter in theassess_feas
function is an array (Arr
) that is passed by reference (&
). It is used to perform calculations and comparisons with the elements of thespectrum
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.
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
: Thex
parameter is of typeArr
, which is likely an array or a slice of some kind. It is passed by reference to theassess_optim
function.sp_sq
: Thesp_sq
parameter in theassess_optim
function is a mutable reference to af64
value. This parameter is updated within the function and its value is used to determine the return values of the function.