pub trait DifferentiableBackground {
// Required methods
fn background_id(&self) -> &str;
fn parameter_names(&self) -> Vec<String>;
fn coefficients(&self) -> Vec<f64>;
fn parameter_bounds(&self) -> Vec<ParameterBounds>;
fn basis(&self, x_deg: &[f64]) -> Result<BackgroundBasis, BackgroundError>;
fn calculate(&self, x_deg: &[f64]) -> Result<Vec<f64>, BackgroundError>;
fn replace_coefficients(
&self,
coefficients: &[f64],
) -> Result<Self, BackgroundError>
where Self: Sized;
fn basis_is_invariant(&self) -> bool;
}Expand description
Shared immutable analytical-background contract.
Required Methods§
Sourcefn background_id(&self) -> &str
fn background_id(&self) -> &str
Stable model identifier.
Sourcefn parameter_names(&self) -> Vec<String>
fn parameter_names(&self) -> Vec<String>
Stable parameter names in coefficient order.
Sourcefn coefficients(&self) -> Vec<f64>
fn coefficients(&self) -> Vec<f64>
Current physical coefficients in derivative-column order.
Sourcefn parameter_bounds(&self) -> Vec<ParameterBounds>
fn parameter_bounds(&self) -> Vec<ParameterBounds>
Physical parameter bounds in coefficient order.
Sourcefn basis(&self, x_deg: &[f64]) -> Result<BackgroundBasis, BackgroundError>
fn basis(&self, x_deg: &[f64]) -> Result<BackgroundBasis, BackgroundError>
Evaluate sample-by-parameter analytical derivatives.
§Errors
Returns BackgroundError for an invalid grid or allocation overflow.
Sourcefn calculate(&self, x_deg: &[f64]) -> Result<Vec<f64>, BackgroundError>
fn calculate(&self, x_deg: &[f64]) -> Result<Vec<f64>, BackgroundError>
Evaluate the background on an ordered finite grid.
§Errors
Returns BackgroundError for an invalid grid or allocation overflow.
Sourcefn replace_coefficients(
&self,
coefficients: &[f64],
) -> Result<Self, BackgroundError>where
Self: Sized,
fn replace_coefficients(
&self,
coefficients: &[f64],
) -> Result<Self, BackgroundError>where
Self: Sized,
Return the same model with replacement coefficients.
§Errors
Returns BackgroundError for shape, finiteness, or model-bound failures.
Sourcefn basis_is_invariant(&self) -> bool
fn basis_is_invariant(&self) -> bool
Return whether the analytical basis is coefficient-invariant.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".