Skip to main content

ParameterMap

Struct ParameterMap 

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

An ordered set of Parameters.

Implementations§

Source§

impl ParameterMap

Source

pub fn register_parameter(&mut self, p: &Parameter) -> LadduResult<ParameterID>

Register a parameter into the ordered map and return its assembled ParameterID.

Source

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

Return the assembled indices of all free parameters.

Source

pub fn rename_parameter(&mut self, old: &str, new: &str) -> LadduResult<()>

Rename a single parameter in place.

Source

pub fn rename_parameters( &mut self, mapping: &HashMap<String, String>, ) -> LadduResult<()>

Rename multiple parameters in place.

Source

pub fn fix_parameter(&self, name: &str, value: f64) -> LadduResult<()>

Fix a parameter to the supplied value.

Source

pub fn free_parameter(&self, name: &str) -> LadduResult<()>

Mark a parameter as free.

Source

pub fn contains_key(&self, name: &str) -> bool

Return whether a parameter with the given name exists.

Source

pub fn index(&self, name: &str) -> Option<usize>

Return the storage index for a named parameter.

Source

pub fn insert(&mut self, parameter: Parameter) -> Option<Parameter>

Insert or replace a parameter by name while preserving insertion order.

Source

pub fn len(&self) -> usize

The number of parameters in the set.

Source

pub fn is_empty(&self) -> bool

Returns true if the parameter set has no elements.

Source

pub fn iter(&self) -> Iter<'_, Parameter>

Iterate over all parameters in the set.

Source

pub fn get(&self, key: &str) -> Option<&Parameter>

Get a parameter by name.

Source

pub fn get_indexed(&self, key: &str) -> Option<(usize, &Parameter)>

Get both the storage index and parameter for a given name.

Source

pub fn names(&self) -> Vec<String>

Get all parameter names in order.

Source

pub fn filter(&self, predicate: impl Fn(&Parameter) -> bool) -> Self

Filter the parameter set by a predicate.

Source

pub fn free(&self) -> Self

Get a set containing only free parameters.

Source

pub fn fixed(&self) -> Self

Get a set containing only fixed parameters.

Source

pub fn initialized(&self) -> Self

Get a set containing only initialized parameters.

Source

pub fn uninitialized(&self) -> Self

Get a set containing only uninitialized parameters.

Source

pub fn assemble(&self, free_values: &[f64]) -> LadduResult<Parameters>

Assemble free inputs into a full Parameters object.

The resulting values are ordered with all free parameters first, followed by fixed ones.

Source

pub fn merge(&self, other: &Self) -> (Self, Vec<usize>, Vec<usize>)

Merge two parameter maps.

When parameters overlap, the state and value stored in self always take precedence over entries from other.

Source

pub fn extend_from(&self, other: &Self) -> (Self, Vec<usize>)

Extend a parameter map from another one.

When both managers reference the same parameter, the value and fixed/free status from self are retained.

Trait Implementations§

Source§

impl Clone for ParameterMap

Source§

fn clone(&self) -> ParameterMap

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ParameterMap

Source§

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

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

impl Default for ParameterMap

Source§

fn default() -> ParameterMap

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ParameterMap

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for ParameterMap

Source§

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

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

impl Index<&str> for ParameterMap

Source§

type Output = Parameter

The returned type after indexing.
Source§

fn index(&self, key: &str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for ParameterMap

Source§

type Output = Parameter

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> IntoIterator for &'a ParameterMap

Source§

type Item = &'a Parameter

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Parameter>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for ParameterMap

Source§

type Item = Parameter

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Parameter>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl Serialize for ParameterMap

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<I, F> SumWithAccumulator<F> for I
where I: IntoIterator<Item = F>,

Source§

fn sum_with_accumulator<Acc>(self) -> F
where Acc: SumAccumulator<F>, F: Zero,

Sums the items of an iterator
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,