fn _cluster<P: DataPoint>(p: &P, clusters: &mut [Cluster<P>]) {
    let mut closest_cluster = 0;
    for c in 1..clusters.len() {
        if P::dist(p, &clusters[c].centroid) < P::dist(p, &clusters[closest_cluster].centroid) {
            closest_cluster = c;
        }
    }
    clusters[closest_cluster].points.push(p.clone());
}
/// Assigns a point to the cluster whose centroid is closest
Assigns a point to the cluster whose centroid is closest
Assigns a point to the cluster whose centroid is closest
fn _cluster<P: DataPoint>(p: &P, clusters: &mut [Cluster<P>]) {
    let mut closest_cluster = 0;
    for c in 1..clusters.len() {
        if P::dist(p, &clusters[c].centroid) < P::dist(p, &clusters[closest_cluster].centroid) {
            closest_cluster = c;
        }
    }
    clusters[closest_cluster].points.push(p.clone());
}
fn _cluster < P : DataPoint > ( p : & P , clusters : & mut [ Cluster < P > ] ) { let mut closest_cluster = 0 ; for c in 1 .. clusters . len ( ) { if P :: dist ( p , & clusters [ c ] . centroid ) < P :: dist ( p , & clusters [ closest_cluster ] . centroid ) { closest_cluster = c ; } } clusters [ closest_cluster ] . points . push ( p . clone ( ) ) ; }
Assigns a point to the cluster whose centroid is closest
Assigns a point to the cluster whose centroid is closest
p
&P
clusters
&mut [Cluster<P>]
p
&P
clusters
&mut [Cluster<P>]