public enum Norm extends Enum<Norm>
The implementations provide increased numerical accuracy. Algorithms primary source is the 2005 paper Accurate Sum and Dot Product by Takeshi Ogita, Siegfried M. Rump, and Shin'ichi Oishi published in SIAM J. Sci. Comput.
Enum Constant and Description |
---|
EUCLIDEAN
Alias for
L2 . |
L1
Manhattan norm (sum of the absolute values of the arguments).
|
L2
|
LINF
Maximum norm (maximum of the absolute values of the arguments).
|
MANHATTAN
Alias for
L1 . |
MAXIMUM
Alias for
LINF . |
Modifier and Type | Method and Description |
---|---|
double |
of(double[] v)
Computes the norm.
|
double |
of(double x,
double y)
Computes the norm.
|
double |
of(double x,
double y,
double z)
Computes the norm.
|
static Norm |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Norm[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Norm L1
public static final Norm LINF
public static Norm[] values()
for (Norm c : Norm.values()) System.out.println(c);
public static Norm valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic final double of(double x, double y)
Special cases:
Double.NaN
, then the result is Double.NaN
.Double.NaN
, then
the result is Double.POSITIVE_INFINITY
.x
- Argument.y
- Argument.public final double of(double x, double y, double z)
Special cases:
Double.NaN
, then the result is Double.NaN
.Double.NaN
, then the
result is Double.POSITIVE_INFINITY
.x
- Argument.y
- Argument.z
- Argument.public final double of(double[] v)
Special cases:
Double.NaN
, then the result is Double.NaN
.Double.NaN
, then the
result is Double.POSITIVE_INFINITY
.v
- Argument.IllegalArgumentException
- if the array is empty.Copyright © 2017–2022 The Apache Software Foundation. All rights reserved.