pub fn weight(&self, distance: f64) -> f64 {
        match self {
            Neighborhood::Gauss => {
                if distance == 0.0 {
                    1.0
                } else {
                    (-0.5 * distance * distance).exp()
                }
            }
            Neighborhood::Triangular => {
                if distance >= 1.0 {
                    0.0
                } else {
                    1.0 - distance
                }
            }
            Neighborhood::Epanechnikov => {
                if distance >= 1.0 {
                    0.0
                } else {
                    1.0 - distance * distance
                }
            }
            Neighborhood::Quartic => {
                if distance >= 1.0 {
                    0.0
                } else {
                    (1.0 - distance * distance).powi(2)
                }
            }
            Neighborhood::Triweight => {
                if distance >= 1.0 {
                    0.0
                } else {
                    (1.0 - distance * distance).powi(3)
                }
            }
        }
    }
/// Calculates the weight, depending on the distance.
Calculates the weight, depending on the distance.
Calculates the weight depending on the distance .
pub fn weight(&self, distance: f64) -> f64 {
        match self {
            Neighborhood::Gauss => {
                if distance == 0.0 {
                    1.0
                } else {
                    (-0.5 * distance * distance).exp()
                }
            }
            Neighborhood::Triangular => {
                if distance >= 1.0 {
                    0.0
                } else {
                    1.0 - distance
                }
            }
            Neighborhood::Epanechnikov => {
                if distance >= 1.0 {
                    0.0
                } else {
                    1.0 - distance * distance
                }
            }
            Neighborhood::Quartic => {
                if distance >= 1.0 {
                    0.0
                } else {
                    (1.0 - distance * distance).powi(2)
                }
            }
            Neighborhood::Triweight => {
                if distance >= 1.0 {
                    0.0
                } else {
                    (1.0 - distance * distance).powi(3)
                }
            }
        }
    }
pub fn weight ( & self , distance : f64 ) -> f64 { match self { Neighborhood :: Gauss => { if distance == 0.0 { 1.0 } else { ( - 0.5 * distance * distance ) . exp ( ) } } Neighborhood :: Triangular => { if distance >= 1.0 { 0.0 } else { 1.0 - distance } } Neighborhood :: Epanechnikov => { if distance >= 1.0 { 0.0 } else { 1.0 - distance * distance } } Neighborhood :: Quartic => { if distance >= 1.0 { 0.0 } else { ( 1.0 - distance * distance ) . powi ( 2 ) } } Neighborhood :: Triweight => { if distance >= 1.0 { 0.0 } else { ( 1.0 - distance * distance ) . powi ( 3 ) } } } }
Calculates the weight, depending on the distance.
Calculates the weight depending on the distance .
&self
distance
f64
&self
distance
f64