pub struct GraphSeparableModel {
pub alpha_keys: Vec<String>,
/* private fields */
}Expand description
Implements varpro’s SeparableNonlinearModel trait for an arbitrary
separable spectrafit graph.
Fields§
§alpha_keys: Vec<String>Names of alpha keys, for mapping results back.
Implementations§
Source§impl GraphSeparableModel
impl GraphSeparableModel
Sourcepub fn new(
graph: &FitGraphSpec,
dataset: &MeasurementSpec,
all_params: &HashMap<String, ParameterSpec>,
) -> Result<Self, ModelError>
pub fn new( graph: &FitGraphSpec, dataset: &MeasurementSpec, all_params: &HashMap<String, ParameterSpec>, ) -> Result<Self, ModelError>
Build from a compiled graph, one dataset, and the full parameter map.
all_params maps "node_id.param_name" → ParameterSpec.
§Errors
Returns [ModelError::ParameterNotInModel] when graph fails to
compile, or [ModelError::IncorrectParameterCount] if the initial
set_params call (used to prime the Φ cache) receives a parameter
vector whose length does not match the model’s own count.
Trait Implementations§
Source§impl Debug for GraphSeparableModel
impl Debug for GraphSeparableModel
Source§impl SeparableNonlinearModel for GraphSeparableModel
impl SeparableNonlinearModel for GraphSeparableModel
Source§type ScalarType = f64
type ScalarType = f64
Source§type Error = ModelError
type Error = ModelError
The associated error type that can occur when the
model or the derivative is evaluated.
If this model does not need (or for performance reasons does not want)
to return an error, it is possible to specify
std::convert::Infallible
as the associated Error type.Source§fn parameter_count(&self) -> usize
fn parameter_count(&self) -> usize
Returns the number of nonlinear parameters that this model depends on.
Source§fn base_function_count(&self) -> usize
fn base_function_count(&self) -> usize
Returns the number of basis functions that this model depends on.
Source§fn output_len(&self) -> usize
fn output_len(&self) -> usize
Returns the dimension
$n$ of the output of the model $\vec{f}(\vec{x},\vec{\alpha},\vec{c}) \in \mathbb{R}^n$.
This is also the dimension of every single basis function.Source§fn set_params(
&mut self,
parameters: OVector<f64, Dyn>,
) -> Result<(), Self::Error>
fn set_params( &mut self, parameters: OVector<f64, Dyn>, ) -> Result<(), Self::Error>
Set the nonlinear parameters
$\vec{\alpha}$ of the model to the given vector .Source§fn params(&self) -> OVector<f64, Dyn>
fn params(&self) -> OVector<f64, Dyn>
Get the currently set nonlinear parameters of the model, i.e.
the vector
$\vec{\alpha}$.Auto Trait Implementations§
impl !RefUnwindSafe for GraphSeparableModel
impl !UnwindSafe for GraphSeparableModel
impl Freeze for GraphSeparableModel
impl Send for GraphSeparableModel
impl Sync for GraphSeparableModel
impl Unpin for GraphSeparableModel
impl UnsafeUnpin for GraphSeparableModel
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
Mutably borrows from an owned value. Read more
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>
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 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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.