[][src]Trait kmeans_colors::Hamerly

pub trait Hamerly: Calculate {
    fn compute_half_distances(centroids: &mut HamerlyCentroids<Self>);
fn get_closest_centroid_hamerly(
        buffer: &[Self],
        centroids: &HamerlyCentroids<Self>,
        indices: &mut [HamerlyPoint]
    );
fn recalculate_centroids_hamerly(
        rng: &mut impl Rng,
        buf: &[Self],
        centroids: &mut HamerlyCentroids<Self>,
        points: &[HamerlyPoint]
    );
fn update_bounds(
        centroids: &HamerlyCentroids<Self>,
        points: &mut [HamerlyPoint]
    ); }

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]
)

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]
)

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]
)

Update the lower and upper bounds of each point.

Loading content...

Implementations on Foreign Types

impl<Wp: WhitePoint> Hamerly for Lab<Wp>[src]

impl Hamerly for Srgb[src]

Loading content...

Implementors

Loading content...