Package com.github.jelmerk.knn.util
Class VectorUtils
- java.lang.Object
-
- com.github.jelmerk.knn.util.VectorUtils
-
public final class VectorUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static float
magnitude(float[] vector)
Calculates the magnitude of the vector.static float[]
normalize(float[] vector)
Turns vector to unit vector.
-
-
-
Method Detail
-
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
-
-