pub struct Projection { /* private fields */ }Expand description
The L2 (Galerkin) projection from src onto dst, kept factored as G⁻¹ M with G the
(banded) Gram matrix of dst and M = ⟨dst, src⟩; G⁻¹ M itself is generally dense.
Implementations§
Source§impl Projection
impl Projection
pub fn new(src: &Space, dst: &Space, weight: Weight) -> Result<Self>
pub fn n_src(&self) -> usize
pub fn n_dst(&self) -> usize
pub fn apply(&self, f: ArrayView1<'_, f64>) -> Array1<f64>
Sourcepub fn apply_last_axis(&self, f: ArrayView2<'_, f64>) -> Array2<f64>
pub fn apply_last_axis(&self, f: ArrayView2<'_, f64>) -> Array2<f64>
Projects each row of f, shape (k, n_src), giving (k, n_dst).
Sourcepub fn apply_bounded_last_axis(
&self,
f: ArrayView2<'_, f64>,
bounds: Bounds,
) -> Array2<f64>
pub fn apply_bounded_last_axis( &self, f: ArrayView2<'_, f64>, bounds: Bounds, ) -> Array2<f64>
The best bounded approximation: the coefficients c minimizing the weighted L2 error ‖f − Σ c_i dst_i‖ subject to the bounds and to conservation, Σ c_i ∫ dst_i w = Σ g_i ∫ dst_i w for the unbounded projection g. Equivalently, c minimizes (c − g)ᵀ G (c − g), a quadratic program with a banded Hessian, solved by a primal-dual active-set method. Because the error is measured on the function, corrections stay local: clipped mass is put back next to where it was removed.
Trait Implementations§
Source§impl Clone for Projection
impl Clone for Projection
Auto Trait Implementations§
impl Freeze for Projection
impl RefUnwindSafe for Projection
impl Send for Projection
impl Sync for Projection
impl Unpin for Projection
impl UnsafeUnpin for Projection
impl UnwindSafe for Projection
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<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> ⓘ
Converts
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> ⓘ
Converts
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 more