pub struct Facility<DataId, T: Send + Sync + Clone> { /* private fields */ }Expand description
A facility is a dataid and the center (or point in data) that correspond to a k medoid point.
The struture stores the data vector and point id which serve as a center, the sum of points weight
attached to this point and the cost (distance between data points and center multiplied by point’s weight)
Implementations§
Source§impl<DataId: Debug + Clone, T: Send + Sync + Clone> Facility<DataId, T>
impl<DataId: Debug + Clone, T: Send + Sync + Clone> Facility<DataId, T>
Sourcepub fn new(d_rank: DataId, center: &[T]) -> Self
pub fn new(d_rank: DataId, center: &[T]) -> Self
creates a facility, around a point characteristics, As the point could be different from data as in kmean we do not set weight. So an explicit insertion with method insert must be done when creation facility is mean to also insert
Sourcepub fn get_position(&self) -> &Vec<T>
pub fn get_position(&self) -> &Vec<T>
get a data point corresponding to the facility location
Sourcepub fn get_dataid(&self) -> DataId
pub fn get_dataid(&self) -> DataId
get data rank this facility is centered on
Sourcepub fn get_weight(&self) -> f64
pub fn get_weight(&self) -> f64
return sum of points’ weight dipatched to this center
Trait Implementations§
Source§impl<'de, DataId, T> Deserialize<'de> for Facility<DataId, T>
impl<'de, DataId, T> Deserialize<'de> for Facility<DataId, T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<DataId, T> Freeze for Facility<DataId, T>where
DataId: Freeze,
impl<DataId, T> RefUnwindSafe for Facility<DataId, T>where
DataId: RefUnwindSafe,
T: RefUnwindSafe,
impl<DataId, T> Send for Facility<DataId, T>where
DataId: Send,
impl<DataId, T> Sync for Facility<DataId, T>where
DataId: Sync,
impl<DataId, T> Unpin for Facility<DataId, T>
impl<DataId, T> UnwindSafe for Facility<DataId, T>where
DataId: UnwindSafe,
T: UnwindSafe,
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