Skip to main content

GraphSeparableModel

Struct GraphSeparableModel 

Source
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

Source

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

Source§

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

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

impl SeparableNonlinearModel for GraphSeparableModel

Source§

type ScalarType = f64

The scalar number type for this model, which should be a real or complex number type, commonly either f64 or f32.
Source§

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

Returns the number of nonlinear parameters that this model depends on.
Source§

fn base_function_count(&self) -> usize

Returns the number of basis functions that this model depends on.
Source§

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>

Set the nonlinear parameters $\vec{\alpha}$ of the model to the given vector .
Source§

fn params(&self) -> OVector<f64, Dyn>

Get the currently set nonlinear parameters of the model, i.e. the vector $\vec{\alpha}$.
Source§

fn eval(&self) -> Result<OMatrix<f64, Dyn, Dyn>, Self::Error>

Evaluate the basis functions of the model at the currently set parameters $\vec{\alpha}$ and return them in matrix form. The columns of this matrix are the evaluated basis functions. See below for a detailed explanation. Read more
Source§

fn eval_partial_deriv( &self, derivative_index: usize, ) -> Result<OMatrix<f64, Dyn, Dyn>, Self::Error>

Evaluate the partial derivatives for the basis functions at the currently set parameters and return them in matrix form. 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> 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> 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

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
§

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

§

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

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

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

The inclusion map: converts self to the equivalent element of its superset.
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.