diff --git a/Cargo.toml b/Cargo.toml
index 39c8697..32912f8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,7 @@ codecov = { repository = "petabi/petal-clustering", service = "github" }
[dependencies]
ndarray = "0.15"
num-traits = "0.2"
-petal-neighbors = "0.9.0"
+petal-neighbors = "0.10.0"
rayon = "1"
serde = { version = "1", features = ["derive"] }
succinct = "0.5"
diff --git a/src/dbscan.rs b/src/dbscan.rs
index 8bd03e3..26630de 100644
--- a/src/dbscan.rs
+++ b/src/dbscan.rs
@@ -1,5 +1,5 @@
use ndarray::{ArrayBase, Data, Ix2};
-use num_traits::{Float, FromPrimitive};
+use num_traits::{float::FloatCore, FromPrimitive};
use petal_neighbors::{
distance::{Euclidean, Metric},
BallTree,
@@ -41,7 +41,7 @@ pub struct Dbscan {
impl Default for Dbscan
where
- A: Float,
+ A: FloatCore,
{
#[must_use]
fn default() -> Self {
@@ -66,7 +66,7 @@ impl Dbscan {
impl Fit, (HashMap>, Vec)> for Dbscan
where
- A: AddAssign + DivAssign + Float + FromPrimitive + Sync,
+ A: AddAssign + DivAssign + FloatCore + FromPrimitive + Sync,
S: Data,
M: Metric + Clone + Sync,
{
@@ -112,7 +112,7 @@ where
fn build_neighborhoods(input: &ArrayBase, eps: A, metric: M) -> Vec>
where
- A: AddAssign + DivAssign + Float + FromPrimitive + Sync,
+ A: AddAssign + DivAssign + FloatCore + FromPrimitive + Sync,
S: Data,
M: Metric + Sync,
{
diff --git a/src/hdbscan.rs b/src/hdbscan.rs
index 30313b2..deeb8b0 100644
--- a/src/hdbscan.rs
+++ b/src/hdbscan.rs
@@ -1,5 +1,5 @@
use ndarray::{Array1, ArrayBase, ArrayView1, ArrayView2, Data, Ix2};
-use num_traits::{Float, FromPrimitive};
+use num_traits::{float::FloatCore, FromPrimitive};
use rayon::prelude::*;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
@@ -29,7 +29,7 @@ pub struct HDbscan {
impl Default for HDbscan
where
- A: Float,
+ A: FloatCore,
{
#[must_use]
fn default() -> Self {
@@ -46,7 +46,7 @@ where
impl Fit, (HashMap>, Vec)> for HDbscan
where
- A: AddAssign + DivAssign + Float + FromPrimitive + Sync + Send + TryFrom,
+ A: AddAssign + DivAssign + FloatCore + FromPrimitive + Sync + Send + TryFrom,
>::Error: Debug,
S: Data,
M: Metric + Clone + Sync + Send,
@@ -92,7 +92,7 @@ where
}
}
-fn mst_linkage(
+fn mst_linkage(
input: ArrayView2,
metric: &dyn Metric,
core_distances: ArrayView1,
@@ -176,7 +176,7 @@ fn mst_linkage(
unsafe { mst.assume_init() }
}
-fn label(mst: Array1<(usize, usize, A)>) -> Array1<(usize, usize, A, usize)> {
+fn label(mst: Array1<(usize, usize, A)>) -> Array1<(usize, usize, A, usize)> {
let n = mst.len() + 1;
let mut uf = UnionFind::new(n);
mst.into_iter()
@@ -188,7 +188,7 @@ fn label(mst: Array1<(usize, usize, A)>) -> Array1<(usize, usize, A, u
.collect()
}
-fn condense_mst(
+fn condense_mst(
mst: ArrayView1<(usize, usize, A, usize)>,
min_cluster_size: usize,
) -> Vec<(usize, usize, A, usize)> {
@@ -275,7 +275,7 @@ fn condense_mst(
result
}
-fn get_stability>(
+fn get_stability>(
condensed_tree: &ArrayView1<(usize, usize, A, usize)>,
) -> HashMap
where
@@ -310,7 +310,7 @@ where
)
}
-fn find_clusters>(
+fn find_clusters>(
condensed_tree: &ArrayView1<(usize, usize, A, usize)>,
) -> (HashMap>, Vec)
where
@@ -411,7 +411,7 @@ fn bfs_tree(tree: &[(usize, usize)], root: usize) -> Vec {
result
}
-fn bfs_mst(mst: ArrayView1<(usize, usize, A, usize)>, start: usize) -> Vec {
+fn bfs_mst(mst: ArrayView1<(usize, usize, A, usize)>, start: usize) -> Vec {
let n = mst.len() + 1;
let mut to_process = vec![start];
@@ -545,7 +545,7 @@ impl UnionFind {
#[allow(dead_code)]
struct Boruvka<'a, A, M>
where
- A: Float,
+ A: FloatCore,
M: Metric,
{
db: BallTree<'a, A, M>,
@@ -560,7 +560,7 @@ where
#[allow(dead_code)]
impl<'a, A, M> Boruvka<'a, A, M>
where
- A: Float + AddAssign + DivAssign + FromPrimitive + Sync + Send,
+ A: FloatCore + AddAssign + DivAssign + FromPrimitive + Sync + Send,
M: Metric + Sync + Send,
{
fn new(db: BallTree<'a, A, M>, min_samples: usize) -> Self {
@@ -789,7 +789,7 @@ fn compute_core_distances(
candidates: &mut Candidates,
) -> Array1
where
- A: AddAssign + DivAssign + FromPrimitive + Float + Sync + Send,
+ A: AddAssign + DivAssign + FromPrimitive + FloatCore + Sync + Send,
M: Metric + Sync + Send,
{
let mut knn_indices = vec![0; db.points.nrows() * min_samples];
@@ -828,7 +828,7 @@ struct Candidates {
}
#[allow(dead_code)]
-impl Candidates {
+impl Candidates {
fn new(n: usize) -> Self {
// define max_value as NULL
let neighbors = vec![u32::max_value(); n];
diff --git a/src/optics.rs b/src/optics.rs
index 1079325..658a306 100644
--- a/src/optics.rs
+++ b/src/optics.rs
@@ -1,5 +1,5 @@
use ndarray::{Array, ArrayBase, Data, Ix2};
-use num_traits::{Float, FromPrimitive};
+use num_traits::{float::FloatCore, FromPrimitive};
use petal_neighbors::{
distance::{Euclidean, Metric},
BallTree,
@@ -46,7 +46,7 @@ pub struct Optics {
impl Default for Optics
where
- A: Float,
+ A: FloatCore,
{
#[must_use]
fn default() -> Self {
@@ -63,7 +63,7 @@ where
impl Optics
where
- A: Float,
+ A: FloatCore,
M: Metric,
{
#[must_use]
@@ -111,7 +111,7 @@ where
impl Fit, (HashMap>, Vec)> for Optics
where
- A: AddAssign + DivAssign + Float + FromPrimitive + Send + Sync,
+ A: AddAssign + DivAssign + FloatCore + FromPrimitive + Send + Sync,
S: Data + Sync,
M: Metric + Clone + Sync,
{
@@ -160,7 +160,7 @@ fn process(
reacheability: &mut [A],
visited: &mut [bool],
) where
- A: Float,
+ A: FloatCore,
S: Data,
M: Metric,
{
@@ -216,7 +216,7 @@ fn update(
seeds: &mut Vec,
reacheability: &mut [A],
) where
- A: Float,
+ A: FloatCore,
S: Data,
M: Metric,
{
@@ -252,7 +252,7 @@ fn build_neighborhoods(
metric: M,
) -> Vec>
where
- A: AddAssign + DivAssign + Float + FromPrimitive + Send + Sync,
+ A: AddAssign + DivAssign + FloatCore + FromPrimitive + Send + Sync,
S: Data,
M: Metric + Sync,
{
@@ -285,7 +285,7 @@ fn reacheability_distance(
metric: &M,
) -> A
where
- A: Float,
+ A: FloatCore,
S: Data,
M: Metric,
{