java.lang.Object
imagingbook.common.math.VectorNorm
imagingbook.common.math.VectorNorm.L2
- Enclosing class:
VectorNorm
Implementation of the L2 vector norm (Euclidean norm/distance). This class defines no public constructor, use
method
getInstance() to retrieve the associated (singleton) instance.-
Nested Class Summary
Nested classes/interfaces inherited from class imagingbook.common.math.VectorNorm
VectorNorm.L1, VectorNorm.L2, VectorNorm.Linf, VectorNorm.NormType -
Method Summary
Modifier and TypeMethodDescriptiondoubledistance(double[] a, double[] b) Returns the distance between twodouble[]vectors under this norm.doubledistance(float[] a, float[] b) Returns the distance between twofloat[]vectors under this norm.doubledistance(int[] a, int[] b) Returns the distance between twoint[]vectors under this norm.doubledistance2(double[] a, double[] b) Returns the squared distance between twodouble[]vectors under this norm.doubledistance2(float[] a, float[] b) Returns the squared distance between twofloat[]vectors under this norm.doubledistance2(int[] a, int[] b) Returns the squared distance between twoint[]vectors under this norm.static VectorNorm.L2Returns an instance of this specificVectorNormtype.doublegetScale(int n) Returns a factor to scale magnitude and distance values to the range of the vector components of dimensionality n.doublemagnitude(double[] a) Returns the magnitude of the specifieddouble[]vector under this norm.doublemagnitude(float[] a) Returns the magnitude of the specifiedfloat[]vector under this norm.doublemagnitude(int[] a) Returns the magnitude of the specifiedint[]vector under this norm.
-
Method Details
-
getInstance
Returns an instance of this specificVectorNormtype.- Returns:
- a
VectorNorminstance
-
magnitude
Description copied from class:VectorNormReturns the magnitude of the specifieddouble[]vector under this norm.- Specified by:
magnitudein classVectorNorm- Parameters:
a- a vector- Returns:
- the magnitude of the vector
-
magnitude
Description copied from class:VectorNormReturns the magnitude of the specifiedfloat[]vector under this norm.- Specified by:
magnitudein classVectorNorm- Parameters:
a- a vector- Returns:
- the magnitude of the vector
-
magnitude
Description copied from class:VectorNormReturns the magnitude of the specifiedint[]vector under this norm.- Specified by:
magnitudein classVectorNorm- Parameters:
a- a vector- Returns:
- the magnitude of the vector
-
distance
Description copied from class:VectorNormReturns the distance between twodouble[]vectors under this norm.- Specified by:
distancein classVectorNorm- Parameters:
a- first vectorb- second vector- Returns:
- the distance between vectors a and b
-
distance2
Description copied from class:VectorNormReturns the squared distance between twodouble[]vectors under this norm.- Specified by:
distance2in classVectorNorm- Parameters:
a- first vectorb- second vector- Returns:
- the distance between vectors a and b
-
distance
Description copied from class:VectorNormReturns the distance between twoint[]vectors under this norm.- Specified by:
distancein classVectorNorm- Parameters:
a- first vectorb- second vector- Returns:
- the distance between vectors a and b
-
distance2
Description copied from class:VectorNormReturns the squared distance between twoint[]vectors under this norm.- Specified by:
distance2in classVectorNorm- Parameters:
a- first vectorb- second vector- Returns:
- the distance between vectors a and b
-
distance
Description copied from class:VectorNormReturns the distance between twofloat[]vectors under this norm.- Specified by:
distancein classVectorNorm- Parameters:
a- first vectorb- second vector- Returns:
- the distance between vectors a and b
-
distance2
Description copied from class:VectorNormReturns the squared distance between twofloat[]vectors under this norm.- Specified by:
distance2in classVectorNorm- Parameters:
a- first vectorb- second vector- Returns:
- the distance between vectors a and b
-
getScale
Description copied from class:VectorNormReturns a factor to scale magnitude and distance values to the range of the vector components of dimensionality n. This is prim. used for scaling color distances (n = 3). E.g., if components are distributed in [0,255], the distances multiplied by this factor should again be in [0,255].- Specified by:
getScalein classVectorNorm- Parameters:
n- dimensionality- Returns:
- scale factor
-