fn calc_distance_matix(nrows: usize, ncols: usize) -> DataFrame {
        let metric = Metric::Euclidean;
        let mut df = DataFrame::filled(nrows * ncols, &vec![""; nrows * ncols], 0.0);
        for r1 in 0..nrows {
            for c1 in 0..ncols {
                let idx1 = r1 * ncols + c1;
                for r2 in 0..nrows {
                    for c2 in 0..ncols {
                        let idx2 = r2 * ncols + c2;
                        df.set(
                            idx1,
                            idx2,
                            metric.distance(&[r1 as f64, c1 as f64], &[r2 as f64, c2 as f64]),
                        );
                    }
                }
            }
        }
        df
    }
/// Pre-calculates the unit-to-unit distance matrix.
Pre-calculates the unit-to-unit distance matrix.
Pre - calculates the unit - to - unit distance matrix .
fn calc_distance_matix(nrows: usize, ncols: usize) -> DataFrame {
        let metric = Metric::Euclidean;
        let mut df = DataFrame::filled(nrows * ncols, &vec![""; nrows * ncols], 0.0);
        for r1 in 0..nrows {
            for c1 in 0..ncols {
                let idx1 = r1 * ncols + c1;
                for r2 in 0..nrows {
                    for c2 in 0..ncols {
                        let idx2 = r2 * ncols + c2;
                        df.set(
                            idx1,
                            idx2,
                            metric.distance(&[r1 as f64, c1 as f64], &[r2 as f64, c2 as f64]),
                        );
                    }
                }
            }
        }
        df
    }
fn calc_distance_matix ( nrows : usize , ncols : usize ) -> DataFrame { let metric = Metric :: Euclidean ; let mut df = DataFrame :: filled ( nrows * ncols , & vec ! [ " " nrows ncols ] , 0.0 ) ; for r1 in 0 .. nrows { for c1 in 0 .. ncols { let idx1 = r1 * ncols + c1 ; for r2 in 0 .. nrows { for c2 in 0 .. ncols { let idx2 = r2 * ncols + c2 ; df . set ( idx1 , idx2 , metric . distance ( & [ r1 as f64 , c1 as f64 ] , & [ r2 as f64 , c2 as f64 ] ) , ) ; } } } } df }
Pre-calculates the unit-to-unit distance matrix.
Pre - calculates the unit - to - unit distance matrix .
nrows
usize
ncols
usize
nrows
usize
ncols
usize