Skip to content

Commit

Permalink
Fixed p norm creation (#231)
Browse files Browse the repository at this point in the history
* Fixed p norm creation
  • Loading branch information
jorgehermo9 authored Jul 29, 2022
1 parent 66d1f45 commit 870107f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion algorithms/linfa-nn/src/distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ impl<F: Float> Distance<F> for LInfDist {

/// L-p or [Minkowsky](https://en.wikipedia.org/wiki/Minkowski_distance) distance
#[derive(Debug, Clone, PartialEq)]
pub struct LpDist<F: Float>(F);
pub struct LpDist<F: Float>(pub F);
impl<F: Float> LpDist<F> {
pub fn new(p: F) -> Self {
LpDist(p)
}
}
impl<F: Float> Distance<F> for LpDist<F> {
#[inline]
fn distance<D: Dimension>(&self, a: ArrayView<F, D>, b: ArrayView<F, D>) -> F {
Expand Down

0 comments on commit 870107f

Please sign in to comment.