pub struct Ball1<'a, T = f64> { /* private fields */ }Expand description
A norm-1 ball, that is, a set given by $B_1^r = \{x \in \mathbb{R}^n {}:{} \Vert{}x{}\Vert_1 \leq r\}$ or a ball-1 centered at a point $x_c$, that is, $B_1^{x_c, r} = \{x \in \mathbb{R}^n {}:{} \Vert{}x-x_c{}\Vert_1 \leq r\}$
Implementations§
Source§impl<'a, T: Float> Ball1<'a, T>
impl<'a, T: Float> Ball1<'a, T>
Sourcepub fn new(center: Option<&'a [T]>, radius: T) -> Self
pub fn new(center: Option<&'a [T]>, radius: T) -> Self
Construct a new ball-1 with given center and radius.
If no center is given, then it is assumed to be in the origin
§Example
use optimization_engine::constraints::{Ball1, Constraint};
let ball = Ball1::new(None, 1.0);
let mut x = [2.0, -0.5];
ball.project(&mut x).unwrap();Trait Implementations§
Source§impl<'a, T> Constraint<T> for Ball1<'a, T>
impl<'a, T> Constraint<T> for Ball1<'a, T>
impl<'a, T: Copy> Copy for Ball1<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Ball1<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for Ball1<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Ball1<'a, T>
impl<'a, T> Sync for Ball1<'a, T>where
T: Sync,
impl<'a, T> Unpin for Ball1<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for Ball1<'a, T>where
T: UnsafeUnpin,
impl<'a, T> UnwindSafe for Ball1<'a, T>where
T: UnwindSafe + RefUnwindSafe,
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