[−][src]Trait kmeans_colors::Hamerly
A trait for calculating k-means with the Hamerly algorithm.
Required methods
fn compute_half_distances(centroids: &mut HamerlyCentroids<Self>)
Find the nearest centers and compute their half-distances.
fn get_closest_centroid_hamerly(
buffer: &[Self],
centroids: &HamerlyCentroids<Self>,
indices: &mut [HamerlyPoint]
)
buffer: &[Self],
centroids: &HamerlyCentroids<Self>,
indices: &mut [HamerlyPoint]
)
Find a point's nearest centroid, index the point with that centroid.
fn recalculate_centroids_hamerly(
rng: &mut impl Rng,
buf: &[Self],
centroids: &mut HamerlyCentroids<Self>,
points: &[HamerlyPoint]
)
rng: &mut impl Rng,
buf: &[Self],
centroids: &mut HamerlyCentroids<Self>,
points: &[HamerlyPoint]
)
Find the new centroid locations based on the average of the points that correspond to the centroid. If no points correspond, the centroid is re-initialized with a random point.
fn update_bounds(
centroids: &HamerlyCentroids<Self>,
points: &mut [HamerlyPoint]
)
centroids: &HamerlyCentroids<Self>,
points: &mut [HamerlyPoint]
)
Update the lower and upper bounds of each point.
Implementations on Foreign Types
impl<Wp: WhitePoint> Hamerly for Lab<Wp>
[src]
fn compute_half_distances(centers: &mut HamerlyCentroids<Self>)
[src]
fn get_closest_centroid_hamerly(
buffer: &[Self],
centers: &HamerlyCentroids<Self>,
points: &mut [HamerlyPoint]
)
[src]
buffer: &[Self],
centers: &HamerlyCentroids<Self>,
points: &mut [HamerlyPoint]
)
fn recalculate_centroids_hamerly(
rng: &mut impl Rng,
buf: &[Self],
centers: &mut HamerlyCentroids<Self>,
points: &[HamerlyPoint]
)
[src]
rng: &mut impl Rng,
buf: &[Self],
centers: &mut HamerlyCentroids<Self>,
points: &[HamerlyPoint]
)
fn update_bounds(centers: &HamerlyCentroids<Self>, points: &mut [HamerlyPoint])
[src]
impl Hamerly for Srgb
[src]
fn compute_half_distances(centers: &mut HamerlyCentroids<Self>)
[src]
fn get_closest_centroid_hamerly(
buffer: &[Self],
centers: &HamerlyCentroids<Self>,
points: &mut [HamerlyPoint]
)
[src]
buffer: &[Self],
centers: &HamerlyCentroids<Self>,
points: &mut [HamerlyPoint]
)
fn recalculate_centroids_hamerly(
rng: &mut impl Rng,
buf: &[Self],
centers: &mut HamerlyCentroids<Self>,
points: &[HamerlyPoint]
)
[src]
rng: &mut impl Rng,
buf: &[Self],
centers: &mut HamerlyCentroids<Self>,
points: &[HamerlyPoint]
)