pub struct ParameterMap { /* private fields */ }Expand description
An ordered set of Parameters.
Implementations§
Source§impl ParameterMap
impl ParameterMap
Sourcepub fn register_parameter(&mut self, p: &Parameter) -> LadduResult<ParameterID>
pub fn register_parameter(&mut self, p: &Parameter) -> LadduResult<ParameterID>
Register a parameter into the ordered map and return its assembled ParameterID.
Sourcepub fn free_parameter_indices(&self) -> Vec<usize>
pub fn free_parameter_indices(&self) -> Vec<usize>
Return the assembled indices of all free parameters.
Sourcepub fn rename_parameter(&mut self, old: &str, new: &str) -> LadduResult<()>
pub fn rename_parameter(&mut self, old: &str, new: &str) -> LadduResult<()>
Rename a single parameter in place.
Sourcepub fn rename_parameters(
&mut self,
mapping: &HashMap<String, String>,
) -> LadduResult<()>
pub fn rename_parameters( &mut self, mapping: &HashMap<String, String>, ) -> LadduResult<()>
Rename multiple parameters in place.
Sourcepub fn fix_parameter(&self, name: &str, value: f64) -> LadduResult<()>
pub fn fix_parameter(&self, name: &str, value: f64) -> LadduResult<()>
Fix a parameter to the supplied value.
Sourcepub fn free_parameter(&self, name: &str) -> LadduResult<()>
pub fn free_parameter(&self, name: &str) -> LadduResult<()>
Mark a parameter as free.
Sourcepub fn contains_key(&self, name: &str) -> bool
pub fn contains_key(&self, name: &str) -> bool
Return whether a parameter with the given name exists.
Sourcepub fn index(&self, name: &str) -> Option<usize>
pub fn index(&self, name: &str) -> Option<usize>
Return the storage index for a named parameter.
Sourcepub fn insert(&mut self, parameter: Parameter) -> Option<Parameter>
pub fn insert(&mut self, parameter: Parameter) -> Option<Parameter>
Insert or replace a parameter by name while preserving insertion order.
Sourcepub fn get_indexed(&self, key: &str) -> Option<(usize, &Parameter)>
pub fn get_indexed(&self, key: &str) -> Option<(usize, &Parameter)>
Get both the storage index and parameter for a given name.
Sourcepub fn filter(&self, predicate: impl Fn(&Parameter) -> bool) -> Self
pub fn filter(&self, predicate: impl Fn(&Parameter) -> bool) -> Self
Filter the parameter set by a predicate.
Sourcepub fn initialized(&self) -> Self
pub fn initialized(&self) -> Self
Get a set containing only initialized parameters.
Sourcepub fn uninitialized(&self) -> Self
pub fn uninitialized(&self) -> Self
Get a set containing only uninitialized parameters.
Sourcepub fn assemble(&self, free_values: &[f64]) -> LadduResult<Parameters>
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.
Sourcepub fn merge(&self, other: &Self) -> (Self, Vec<usize>, Vec<usize>)
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.
Sourcepub fn extend_from(&self, other: &Self) -> (Self, Vec<usize>)
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
impl Clone for ParameterMap
Source§fn clone(&self) -> ParameterMap
fn clone(&self) -> ParameterMap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParameterMap
impl Debug for ParameterMap
Source§impl Default for ParameterMap
impl Default for ParameterMap
Source§fn default() -> ParameterMap
fn default() -> ParameterMap
Source§impl<'de> Deserialize<'de> for ParameterMap
impl<'de> Deserialize<'de> for ParameterMap
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for ParameterMap
impl Display for ParameterMap
Source§impl Index<&str> for ParameterMap
impl Index<&str> for ParameterMap
Source§impl Index<usize> for ParameterMap
impl Index<usize> for ParameterMap
Source§impl<'a> IntoIterator for &'a ParameterMap
impl<'a> IntoIterator for &'a ParameterMap
Source§impl IntoIterator for ParameterMap
impl IntoIterator for ParameterMap
Auto Trait Implementations§
impl Freeze for ParameterMap
impl !RefUnwindSafe for ParameterMap
impl Send for ParameterMap
impl Sync for ParameterMap
impl Unpin for ParameterMap
impl UnsafeUnpin for ParameterMap
impl !UnwindSafe for ParameterMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<I, F> SumWithAccumulator<F> for Iwhere
I: IntoIterator<Item = F>,
impl<I, F> SumWithAccumulator<F> for Iwhere
I: IntoIterator<Item = F>,
Source§fn sum_with_accumulator<Acc>(self) -> Fwhere
Acc: SumAccumulator<F>,
F: Zero,
fn sum_with_accumulator<Acc>(self) -> Fwhere
Acc: SumAccumulator<F>,
F: Zero,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.