Modifier and Type | Method and Description |
---|---|
static double |
checkedNorm(double norm)
Throws an
IllegalArgumentException if the given norm value
is not real (ie, not NaN or infinite) or zero. |
static double |
checkedNorm(Vector<?> vec)
Returns the vector's norm value, throwing an
IllegalArgumentException if the value
is not real (ie, not NaN or infinite) or zero. |
static boolean |
isRealNonZero(double value)
Returns true if the given value is real (ie, not NaN or infinite)
and not equal to zero.
|
static double |
norm(double x)
Get the L2 norm (commonly known as the Euclidean norm) for the vector
with the given components.
|
static double |
norm(double x1,
double x2)
Get the L2 norm (commonly known as the Euclidean norm) for the vector
with the given components.
|
static double |
norm(double x1,
double x2,
double x3)
Get the L2 norm (commonly known as the Euclidean norm) for the vector
with the given components.
|
static double |
normSq(double x)
Get the square of the L2 norm (also known as the Euclidean norm)
for the vector with the given components.
|
static double |
normSq(double x1,
double x2)
Get the square of the L2 norm (also known as the Euclidean norm)
for the vector with the given components.
|
static double |
normSq(double x1,
double x2,
double x3)
Get the square of the L2 norm (also known as the Euclidean norm)
for the vector with the given components.
|
static <V extends Vector<V>> |
tryNormalize(V vec)
Attempt to normalize the given vector, returning null if the vector cannot be normalized
due to the norm being NaN, infinite, or null.
|
public static boolean isRealNonZero(double value)
value
- the value to testvalue
is not NaN, infinite, or zero; otherwise
falsepublic static double checkedNorm(double norm)
IllegalArgumentException
if the given norm value
is not real (ie, not NaN or infinite) or zero. The argument is returned
to allow this method to be called inline.norm
- vector norm valueIllegalArgumentException
- if the given norm value is NaN, infinite,
or zeropublic static double checkedNorm(Vector<?> vec)
IllegalArgumentException
if the value
is not real (ie, not NaN or infinite) or zero.vec
- vector to obtain the real, non-zero norm ofIllegalArgumentException
- if the vector norm value is NaN, infinite,
or zeropublic static <V extends Vector<V>> V tryNormalize(V vec)
V
- Vector implementation typevec
- the vector to attempt to normalizepublic static double norm(double x)
x
- vector componentpublic static double norm(double x1, double x2)
x1
- first vector componentx2
- second vector componentpublic static double norm(double x1, double x2, double x3)
x1
- first vector componentx2
- second vector componentx3
- third vector componentpublic static double normSq(double x)
x
- vector componentnorm(double)
public static double normSq(double x1, double x2)
x1
- first vector componentx2
- second vector componentnorm(double, double)
public static double normSq(double x1, double x2, double x3)
x1
- first vector componentx2
- second vector componentx3
- third vector componentnorm(double, double, double)
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.