Struct optimization_engine::constraints::Sphere2
source · pub struct Sphere2<'a> { /* private fields */ }
Expand description
A Euclidean sphere, that is, a set given by $S_2^r = \{x \in \mathbb{R}^n {}:{} \Vert{}x{}\Vert = r\}$ or a Euclidean sphere centered at a point $x_c$, that is, $S_2^{x_c, r} = \{x \in \mathbb{R}^n {}:{} \Vert{}x-x_c{}\Vert = r\}$
Implementations§
Trait Implementations§
source§impl<'a> Constraint for Sphere2<'a>
impl<'a> Constraint for Sphere2<'a>
source§fn project(&self, x: &mut [f64])
fn project(&self, x: &mut [f64])
Projection onto the sphere, $S_{r, c}$ with radius $r$ and center $c$. If $x\neq c$, the projection is uniquely defined by
$$ P_{S_{r, c}}(x) = c + r\frac{x-c}{\Vert{}x-c\Vert_2}, $$
but for $x=c$, the projection is multi-valued. In particular, let $y = P_{S_{r, c}}(c)$. Then $y_1 = c_1 + r$ and $y_i = c_i$ for $i=2,\ldots, n$.
§Arguments
x
: The given vector $x$ is updated with the projection on the set
impl<'a> Copy for Sphere2<'a>
Auto Trait Implementations§
impl<'a> Freeze for Sphere2<'a>
impl<'a> RefUnwindSafe for Sphere2<'a>
impl<'a> Send for Sphere2<'a>
impl<'a> Sync for Sphere2<'a>
impl<'a> Unpin for Sphere2<'a>
impl<'a> UnwindSafe for Sphere2<'a>
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