#[non_exhaustive]pub struct MultiFunData { /* private fields */ }Expand description
Multi-domain functional data container.
Holds several FdComponent blocks that may live on different domains
(grids, lengths). The invariant shared across all components is that they
must all record the same number of observations (data.nrows()). Each
component keeps its own evaluation grid so that multi-domain data (e.g.
temperature + precipitation observed at different densities) can coexist
under a single object.
Constructed via MultiFunData::new, which validates both invariants:
- All components must have
data.nrows() == n_obs(equal observation count). - Each component must have
argvals.len() == data.ncols().
§Examples
use fdars_core::matrix::FdMatrix;
use fdars_core::multi_fdata::{FdComponent, MultiFunData};
let n = 8;
let comp_a = FdComponent {
data: FdMatrix::zeros(n, 20),
argvals: (0..20).map(|i| i as f64).collect(),
};
let comp_b = FdComponent {
data: FdMatrix::zeros(n, 5),
argvals: vec![0.0, 0.25, 0.5, 0.75, 1.0],
};
let mfd = MultiFunData::new(vec![comp_a, comp_b]).unwrap();
assert_eq!(mfd.n_obs(), n);
assert_eq!(mfd.n_components(), 2);Implementations§
Source§impl MultiFunData
impl MultiFunData
Sourcepub fn new(components: Vec<FdComponent>) -> Result<Self, FdarError>
pub fn new(components: Vec<FdComponent>) -> Result<Self, FdarError>
Construct a validated multi-domain functional data container.
§Invariants enforced
componentsmust be non-empty.- All components must share the same observation count (
data.nrows()). - Each component must satisfy
argvals.len() == data.ncols().
§Errors
FdarError::InvalidParameter—componentsis empty.FdarError::InvalidDimension— observation count mismatch across components, orargvals.len() != data.ncols()for any component.
§Examples
use fdars_core::matrix::FdMatrix;
use fdars_core::multi_fdata::{FdComponent, MultiFunData};
let comp = FdComponent {
data: FdMatrix::zeros(3, 6),
argvals: vec![0.0, 0.2, 0.4, 0.6, 0.8, 1.0],
};
let mfd = MultiFunData::new(vec![comp]).unwrap();
assert_eq!(mfd.n_obs(), 3);Sourcepub fn n_obs(&self) -> usize
pub fn n_obs(&self) -> usize
Number of observations shared by all components.
§Panics
Never — components is always non-empty after MultiFunData::new.
Sourcepub fn n_components(&self) -> usize
pub fn n_components(&self) -> usize
Number of components.
Sourcepub fn component(&self, k: usize) -> Result<&FdComponent, FdarError>
pub fn component(&self, k: usize) -> Result<&FdComponent, FdarError>
Return a reference to the k-th component.
§Errors
FdarError::InvalidParameter if k >= n_components().
Trait Implementations§
Source§impl Clone for MultiFunData
impl Clone for MultiFunData
Source§fn clone(&self) -> MultiFunData
fn clone(&self) -> MultiFunData
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 MultiFunData
impl Debug for MultiFunData
Source§impl PartialEq for MultiFunData
impl PartialEq for MultiFunData
impl StructuralPartialEq for MultiFunData
Auto Trait Implementations§
impl Freeze for MultiFunData
impl RefUnwindSafe for MultiFunData
impl Send for MultiFunData
impl Sync for MultiFunData
impl Unpin for MultiFunData
impl UnsafeUnpin for MultiFunData
impl UnwindSafe for MultiFunData
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
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.