org.apache.ignite.ml.math.distances

## Class MinkowskiDistance

- java.lang.Object
- - org.apache.ignite.ml.math.distances.MinkowskiDistance

- All Implemented Interfaces:
    Externalizable, Serializable, DistanceMeasure

      public class MinkowskiDistance
      extends Object
      implements DistanceMeasure

  Calculates the Lp (Minkowski) distance between two points.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MinkowskiDistance(double p)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `compute(Vector a, Vector b)` Compute the distance between two n-dimensional vectors.
    `boolean` | `equals(Object o)`
    `double` | `getP()` Returns p-norm.
    `int` | `hashCode()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.ml.math.distances.DistanceMeasure

      `compute, readExternal, writeExternal`

- - ### Constructor Detail

    - #### MinkowskiDistance

          public MinkowskiDistance(double p)

      Parameters:
        `p` - norm

  - ### Method Detail

    - #### getP

          public double getP()

      Returns p-norm.

    - #### compute

          public double compute(Vector a,
                                Vector b)
                         throws CardinalityException

      Compute the distance between two n-dimensional vectors.

      The two vectors are required to have the same dimension.

      Specified by:
        `compute` in interface `DistanceMeasure`
      Parameters:
        `a` - The first vector.
        `b` - The second vector.
      Returns:
        The distance between the two vectors.
      Throws:
        `CardinalityException` - if the array lengths differ.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022