@@ -4,8 +4,15 @@ use linfa::Float;
44use linfa_nn:: distance:: { Distance , L2Dist } ;
55use ndarray:: { Array1 , ArrayView1 , ArrayView2 , ArrayViewMut1 } ;
66use partitions:: PartitionVec ;
7+ #[ cfg( feature = "serde" ) ]
8+ use serde_crate:: { Deserialize , Serialize } ;
79
810#[ derive( Clone , Debug , PartialEq , Eq ) ]
11+ #[ cfg_attr(
12+ feature = "serde" ,
13+ derive( Serialize , Deserialize ) ,
14+ serde( crate = "serde_crate" )
15+ ) ]
916/// A point in a D dimensional euclidean space that memorizes its
1017/// status: 'core' or 'non core'
1118pub struct StatusPoint {
@@ -16,10 +23,7 @@ pub struct StatusPoint {
1623
1724impl StatusPoint {
1825 pub fn new ( point_index : usize ) -> StatusPoint {
19- StatusPoint {
20- point_index,
21- is_core : false ,
22- }
26+ StatusPoint { point_index, is_core : false }
2327 }
2428
2529 pub fn is_core ( & self ) -> bool {
@@ -32,6 +36,11 @@ impl StatusPoint {
3236}
3337
3438#[ derive( Clone , Debug , PartialEq ) ]
39+ #[ cfg_attr(
40+ feature = "serde" ,
41+ derive( Serialize , Deserialize ) ,
42+ serde( crate = "serde_crate" )
43+ ) ]
3544/// Informations regarding the cell used in various stages of the approximate DBSCAN
3645/// algorithm if it is a core cell
3746pub struct CoreCellInfo < F : Float > {
@@ -42,6 +51,11 @@ pub struct CoreCellInfo<F: Float> {
4251}
4352
4453#[ derive( Clone , Debug , PartialEq ) ]
54+ #[ cfg_attr(
55+ feature = "serde" ,
56+ derive( Serialize , Deserialize ) ,
57+ serde( crate = "serde_crate" )
58+ ) ]
4559/// A cell from a grid that partitions the D dimensional euclidean space.
4660pub struct Cell < F : Float > {
4761 /// The index of the intervals of the D dimensional axes where this cell lies
0 commit comments