1
1
#![ allow( non_snake_case) ]
2
2
use itertools:: Itertools ;
3
3
///
4
- /// FastPair: Data-structure for the dynamic closest-pair problem.
4
+ /// # FastPair: Data-structure for the dynamic closest-pair problem.
5
5
///
6
6
/// Reference:
7
7
/// Eppstein, David: Fast hierarchical clustering and other applications of
8
8
/// dynamic closest pairs. Journal of Experimental Algorithmics 5 (2000) 1.
9
9
///
10
+ /// Example:
11
+ /// ```
12
+ /// use smartcore::algorithm::neighbour::distances::PairwiseDistance;
13
+ /// use smartcore::linalg::naive::dense_matrix::DenseMatrix;
14
+ /// use smartcore::algorithm::neighbour::fastpair::FastPair;
15
+ /// let x = DenseMatrix::<f64>::from_2d_array(&[
16
+ /// &[5.1, 3.5, 1.4, 0.2],
17
+ /// &[4.9, 3.0, 1.4, 0.2],
18
+ /// &[4.7, 3.2, 1.3, 0.2],
19
+ /// &[4.6, 3.1, 1.5, 0.2],
20
+ /// &[5.0, 3.6, 1.4, 0.2],
21
+ /// &[5.4, 3.9, 1.7, 0.4],
22
+ /// ]);
23
+ /// let fastpair = FastPair::new(&x);
24
+ /// let closest_pair: PairwiseDistance<f64> = fastpair.unwrap().closest_pair();
25
+ /// ```
26
+ /// <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
27
+ /// <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
10
28
use std:: collections:: HashMap ;
11
29
12
30
use crate :: algorithm:: neighbour:: distances:: PairwiseDistance ;
@@ -16,9 +34,7 @@ use crate::math::distance::euclidian::Euclidian;
16
34
use crate :: math:: num:: RealNumber ;
17
35
18
36
///
19
- /// FastPair
20
- ///
21
- /// Ported from Python implementation:
37
+ /// Inspired by Python implementation:
22
38
/// <https://github.com/carsonfarmer/fastpair/blob/b8b4d3000ab6f795a878936667eee1b557bf353d/fastpair/base.py>
23
39
/// MIT License (MIT) Copyright (c) 2016 Carson Farmer
24
40
///
0 commit comments