pub struct Lfd {
pub coefs: Vec<Vec<f64>>,
}Expand description
A linear differential operator of the form
Lx(t) = D^m x(t) + β_{m-1}(t)·D^{m-1}x(t) + … + β₀(t)·x(t).
The operator holds m weight functions β₀, …, β_{m-1} (where m is the
order of L). Each weight function is sampled on the same evaluation
grid that is later supplied to Lfd::apply.
§Constant-coefficient operators
A length-1 inner Vec<f64> in coefs is treated as a constant and broadcast
to all grid points. For example, coefs = vec![vec![-9.87]] represents the
operator Lx = Dx - 9.87·x (order 1, constant negative spring constant).
Fields§
§coefs: Vec<Vec<f64>>Weight functions β₀(t), …, β_{m-1}(t), each sampled on the evaluation grid.
coefs.len() equals the operator order m.
coefs[k] must have length either 1 (constant, broadcast) or n_pts
(grid-sampled), where n_pts = argvals.len() when apply is
called.
Implementations§
Source§impl Lfd
impl Lfd
Sourcepub fn apply(
&self,
data: &FdMatrix,
argvals: &[f64],
) -> Result<FdMatrix, FdarError>
pub fn apply( &self, data: &FdMatrix, argvals: &[f64], ) -> Result<FdMatrix, FdarError>
Apply the operator to each curve in data.
For a curve xᵢ, computes the scalar sequence
Lxᵢ(t_j) = D^m xᵢ(t_j) + Σ_{k=0}^{m-1} βₖ(t_j) · D^k xᵢ(t_j).
Derivatives are estimated via the iterated finite-difference scheme in
crate::helpers::gradient (5-point stencil on uniform grids, 3-point
Lagrange on non-uniform grids).
§Arguments
data— Functional data matrix(n × n_pts); each row is one curve.argvals— Evaluation points (lengthn_pts, must be sorted ascending).
§Errors
FdarError::InvalidParameterifcoefsis empty (m = 0); usecoefs = vec![vec![0.0]]for a pure first-derivative operator.FdarError::InvalidDimensionifn_pts < 2(single-point grid cannot produce derivatives).FdarError::InvalidDimensionifargvals.len() != data.ncols().FdarError::InvalidDimensionif anycoefs[k]has a length other than1orn_pts.
§Returns
An FdMatrix of the same shape as data, containing the operator output.
Trait Implementations§
impl StructuralPartialEq for Lfd
Auto Trait Implementations§
impl Freeze for Lfd
impl RefUnwindSafe for Lfd
impl Send for Lfd
impl Sync for Lfd
impl Unpin for Lfd
impl UnsafeUnpin for Lfd
impl UnwindSafe for Lfd
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.