ParamInfo

Struct ParamInfo 

Source
pub struct ParamInfo { /* private fields */ }
Expand description

Information about function parameters, including their indices and whether they are constant.

§Fields

  • indices - The parameter indices, stored as either consecutive or disjoint ranges
  • constant - A vector indicating whether each parameter is constant (true) or variable (false)

Implementations§

Source§

impl ParamInfo

Source

pub fn new(indices: impl Into<ParamIndices>, constant: Vec<bool>) -> ParamInfo

Creates a new ParamInfo with the given parameter indices and constant flags.

§Arguments
  • indices - The parameter indices (can be any type that converts to ParamIndices)
  • constant - A vector indicating whether each parameter is constant
§Returns

A new ParamInfo instance.

§Panics

The length of the constant vector should match the number of parameters in indices.

Source

pub fn parameterized(indices: impl Into<ParamIndices>) -> ParamInfo

Creates a new ParamInfo where all parameters are variable (not constant).

This is a convenience method for creating parameter information where all parameters can vary during optimization or analysis.

§Arguments
  • indices - The parameter indices (can be any type that converts to ParamIndices)
§Returns

A new ParamInfo instance with all parameters marked as variable.

Source

pub fn to_sorted(&self) -> ParamInfo

Returns a new ParamInfo with its parameter indices sorted.

If the ParamIndices are Disjoint, the internal vector is sorted. If the ParamIndices are Joint, they remain Joint as their order is inherently sorted. The constant vector is reordered to match the new order of indices.

Source

pub fn union(&self, other: &ParamInfo) -> ParamInfo

Unions this ParamInfo with another, combining their parameter indices and constant flags.

This operation combines parameter indices from both ParamInfo instances. If a parameter index appears in both instances, their constant flags must match or an assertion will fail.

§Arguments
  • other - The other ParamInfo to concatenate with
§Returns

A new ParamInfo containing the combined parameters and their constant status.

Source

pub fn intersect(&self, other: &ParamInfo) -> ParamInfo

Computes the intersection of this ParamInfo with another.

Returns a new ParamInfo containing only the parameters that are present in both instances. The constant flags must match for common parameters.

§Arguments
  • other - The other ParamInfo to intersect with
§Returns

A new ParamInfo containing only the common parameters.

Source

pub fn num_params(&self) -> usize

Returns the total number of parameters.

§Returns

The number of parameters tracked by this ParamInfo.

Source

pub fn num_var_params(&self) -> usize

Returns the total number of variable parameters.

§Returns

The number of non-constant parameters tracked by this ParamInfo.

Source

pub fn get_param_map(&self) -> Vec<u64>

Returns the parameter indices as a vector of u64 values.

This is useful for interfacing with external libraries that expect parameter indices as 64-bit unsigned integers.

§Returns

A vector containing all parameter indices converted to u64.

Source

pub fn get_const_map(&self) -> Vec<bool>

Returns a copy of the constant flags for all parameters.

The returned vector has the same length as the number of parameters, where each boolean indicates whether the corresponding parameter is constant.

§Returns

A vector of boolean values indicating parameter constancy.

Source

pub fn empty() -> ParamInfo

Creates an empty ParamInfo with no parameters.

This is useful as a default or starting point for parameter information.

§Returns

An empty ParamInfo instance.

Source

pub fn is_empty(&self) -> bool

Checks if this ParamInfo contains no parameters.

§Returns

true if there are no parameters, false otherwise.

Source

pub fn len(&self) -> usize

Returns the number of parameters (alias for num_params).

§Returns

The total number of parameters.

Source

pub fn sorted_non_constant(&self) -> Vec<usize>

Returns a sorted vector of indices for parameters that are not constant.

This is useful for optimization routines that only need to vary non-constant parameters.

§Returns

A sorted vector containing the indices of all non-constant parameters.

Trait Implementations§

Source§

impl Clone for ParamInfo

Source§

fn clone(&self) -> ParamInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParamInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ParamInfo

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ParamInfo

Source§

fn eq(&self, other: &ParamInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for ParamInfo

Source§

impl StructuralPartialEq for ParamInfo

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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V