pub struct FunctionalDerivative;Expand description
Gâteaux and Fréchet derivatives of functionals on function spaces.
Enables gradient descent in function space and Newton’s method for operator equations.
Implementations§
Source§impl FunctionalDerivative
impl FunctionalDerivative
Sourcepub fn gateaux<F>(j: F, f: &[f64], h: &[f64], eps: f64) -> f64
pub fn gateaux<F>(j: F, f: &[f64], h: &[f64], eps: f64) -> f64
Compute the Gâteaux derivative of functional J at f in direction h.
dJ/dε J(f + εh)|_{ε=0} approximated by finite difference.
Sourcepub fn frechet_gradient<F>(j: F, f: &[f64], eps: f64) -> Vec<f64>
pub fn frechet_gradient<F>(j: F, f: &[f64], eps: f64) -> Vec<f64>
Compute the Fréchet derivative (gradient) of functional J at f.
Returns the gradient vector δJ/δf using component-wise Gâteaux
derivatives with standard basis directions.
Sourcepub fn gradient_descent<F>(
j: F,
f0: &[f64],
step_size: f64,
max_iter: usize,
eps: f64,
) -> (Vec<f64>, f64)
pub fn gradient_descent<F>( j: F, f0: &[f64], step_size: f64, max_iter: usize, eps: f64, ) -> (Vec<f64>, f64)
Perform gradient descent in function space to minimize functional J.
Starting from f0, takes max_iter steps of size step_size.
Returns the minimizer and the final functional value.
Sourcepub fn newton_step<F>(j: F, f: &[f64], eps: f64) -> Vec<f64>
pub fn newton_step<F>(j: F, f: &[f64], eps: f64) -> Vec<f64>
Newton step in function space: f_new = f - \[D²J(f)\]⁻¹ DJ(f).
Approximates the Hessian-vector product via a second finite difference and solves the linear system by a simple diagonal preconditioned gradient step (one step of Jacobi iteration).
Auto Trait Implementations§
impl Freeze for FunctionalDerivative
impl RefUnwindSafe for FunctionalDerivative
impl Send for FunctionalDerivative
impl Sync for FunctionalDerivative
impl Unpin for FunctionalDerivative
impl UnsafeUnpin for FunctionalDerivative
impl UnwindSafe for FunctionalDerivative
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
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.