pub struct ProjectionOperator;Expand description
Collection of projection operators onto standard convex sets.
Each method returns the projection of a given point onto a specified set.
Implementations§
Source§impl ProjectionOperator
impl ProjectionOperator
Sourcepub fn onto_hyperplane(x: &[f64], a: &[f64], b: f64) -> Vec<f64>
pub fn onto_hyperplane(x: &[f64], a: &[f64], b: f64) -> Vec<f64>
Project x onto the hyperplane {z : aᵀz = b}.
proj(x) = x - (aᵀx - b) / ||a||² · a
Sourcepub fn onto_halfspace(x: &[f64], a: &[f64], b: f64) -> Vec<f64>
pub fn onto_halfspace(x: &[f64], a: &[f64], b: f64) -> Vec<f64>
Project x onto the halfspace {z : aᵀz ≤ b}.
If x is already in the halfspace returns x unchanged.
Sourcepub fn onto_ball(x: &[f64], center: &[f64], radius: f64) -> Vec<f64>
pub fn onto_ball(x: &[f64], center: &[f64], radius: f64) -> Vec<f64>
Project x onto the Euclidean ball B(center, radius).
Sourcepub fn onto_box(x: &[f64], lo: &[f64], hi: &[f64]) -> Vec<f64>
pub fn onto_box(x: &[f64], lo: &[f64], hi: &[f64]) -> Vec<f64>
Project x onto the axis-aligned box [lo, hi] component-wise.
Sourcepub fn onto_simplex(x: &[f64]) -> Vec<f64>
pub fn onto_simplex(x: &[f64]) -> Vec<f64>
Project x onto the probability simplex Δ = {z ≥ 0 : sum z = 1}.
Auto Trait Implementations§
impl Freeze for ProjectionOperator
impl RefUnwindSafe for ProjectionOperator
impl Send for ProjectionOperator
impl Sync for ProjectionOperator
impl Unpin for ProjectionOperator
impl UnsafeUnpin for ProjectionOperator
impl UnwindSafe for ProjectionOperator
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<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.