Package com.arcadedb.index.vector
Class VectorUtils
- java.lang.Object
-
- com.arcadedb.index.vector.VectorUtils
-
public final class VectorUtils extends Object
This work is derived from the excellent work made by Jelmer Kuperus on https://github.com/jelmerk/hnswlib.Misc utility methods for dealing with vectors.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
magnitude(double[] vector)
Calculates the magnitude of the vector.static float
magnitude(float[] vector)
Calculates the magnitude of the vector.static double[]
normalize(double[] vector)
Turns vector to unit vector.static float[]
normalize(float[] vector)
Turns vector to unit vector.
-
-
-
Method Detail
-
magnitude
public static double magnitude(double[] vector)
Calculates the magnitude of the vector.- Parameters:
vector
- The vector to calculate magnitude for.- Returns:
- The magnitude.
-
normalize
public static double[] normalize(double[] vector)
Turns vector to unit vector.- Parameters:
vector
- The vector to normalize.- Returns:
- the input vector as a unit vector
-
magnitude
public static float magnitude(float[] vector)
Calculates the magnitude of the vector.- Parameters:
vector
- The vector to calculate magnitude for.- Returns:
- The magnitude.
-
normalize
public static float[] normalize(float[] vector)
Turns vector to unit vector.- Parameters:
vector
- The vector to normalize.- Returns:
- the input vector as a unit vector
-
-