pub struct HilbertSpace {
pub dx: f64,
pub n: usize,
}Expand description
A discrete Hilbert space over a uniform grid with spacing dx.
Provides inner product, norm, orthonormalization (Gram-Schmidt), and projection operations.
Fields§
§dx: f64Grid spacing for integration approximation.
n: usizeNumber of grid points.
Implementations§
Source§impl HilbertSpace
impl HilbertSpace
Sourcepub fn new(n: usize, dx: f64) -> Self
pub fn new(n: usize, dx: f64) -> Self
Create a new HilbertSpace with n grid points and spacing dx.
Sourcepub fn inner_product(&self, f: &[f64], g: &[f64]) -> f64
pub fn inner_product(&self, f: &[f64], g: &[f64]) -> f64
Compute the L² inner product ⟨f, g⟩.
Sourcepub fn orthonormalize(&self, basis: &[Vec<f64>]) -> Vec<Vec<f64>>
pub fn orthonormalize(&self, basis: &[Vec<f64>]) -> Vec<Vec<f64>>
Orthonormalize a set of vectors using the modified Gram-Schmidt process.
Returns the orthonormal set in the same order; linearly dependent vectors become zero.
Sourcepub fn project(&self, f: &[f64], basis: &[Vec<f64>]) -> Vec<f64>
pub fn project(&self, f: &[f64], basis: &[Vec<f64>]) -> Vec<f64>
Project f onto the subspace spanned by basis.
basis does not need to be orthonormal; a fresh Gram-Schmidt step
is performed internally. Returns the projected vector (same length as
f).
Sourcepub fn distance(&self, f: &[f64], g: &[f64]) -> f64
pub fn distance(&self, f: &[f64], g: &[f64]) -> f64
Compute the distance between two functions f and g.
Trait Implementations§
Source§impl Clone for HilbertSpace
impl Clone for HilbertSpace
Source§fn clone(&self) -> HilbertSpace
fn clone(&self) -> HilbertSpace
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HilbertSpace
impl RefUnwindSafe for HilbertSpace
impl Send for HilbertSpace
impl Sync for HilbertSpace
impl Unpin for HilbertSpace
impl UnsafeUnpin for HilbertSpace
impl UnwindSafe for HilbertSpace
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.