pub fn nearest_neighbor_xyf(from: &[f64], to: &DataFrame, layers: &[Layer]) -> (usize, f64) {
    assert_eq!(from.len(), to.ncols());

    let mut min_dist = std::f64::MAX;
    let mut min_idx: usize = 0;
    for (idx_to, row_to) in to.iter_rows().enumerate() {
        let dist = distance_xyf(from, row_to, layers, min_dist);
        //let dist = distance_xyf(from, row_to, layers, std::f64::MAX);
        if dist < min_dist {
            min_dist = dist;
            min_idx = idx_to;
        }
    }
    (min_idx, min_dist)
}
/// Nearest-neighbor for XYF-maps. Layers determine distance metrics and weighting.
/// Dimensions with `NA` values are ignored.
/// # Returns
/// (index, weighted-distance)
Nearest-neighbor for XYF-maps. Layers determine distance metrics and weighting.
Dimensions with `NA` values are ignored.
Nearest - neighbor for XYF - maps . Layers determine distance metrics and weighting . Dimensions with ` NA ` values are ignored .
pub fn nearest_neighbor_xyf(from: &[f64], to: &DataFrame, layers: &[Layer]) -> (usize, f64) {
    assert_eq!(from.len(), to.ncols());
    let mut min_dist = std::f64::MAX;
    let mut min_idx: usize = 0;
    for (idx_to, row_to) in to.iter_rows().enumerate() {
        let dist = distance_xyf(from, row_to, layers, min_dist);
        //let dist = distance_xyf(from, row_to, layers, std::f64::MAX);
        if dist < min_dist {
            min_dist = dist;
            min_idx = idx_to;
        }
    }
    (min_idx, min_dist)
}
pub fn nearest_neighbor_xyf ( from : & [ f64 ] , to : & DataFrame , layers : & [ Layer ] ) -> ( usize , f64 ) { assert_eq ! ( from len ( ) to ncols ( ) ) ; let mut min_dist = std :: f64 :: MAX ; let mut min_idx : usize = 0 ; for ( idx_to , row_to ) in to . iter_rows ( ) . enumerate ( ) { let dist = distance_xyf ( from , row_to , layers , min_dist ) ; //let dist = distance_xyf(from, row_to, layers, std::f64::MAX); if dist < min_dist { min_dist = dist ; min_idx = idx_to ; } } ( min_idx , min_dist ) }
Nearest-neighbor for XYF-maps.
Nearest - neighbor for XYF - maps .
from
&[f64]
to
&DataFrame
layers
&[Layer]
None
from
&[f64]
to
&DataFrame
layers
&[Layer]