Package org.apache.commons.numbers.core
Enum Norm
- All Implemented Interfaces:
Serializable,Comparable<Norm>
Norm functions.
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 Summary
Enum ConstantsEnum ConstantDescriptionAlias forL2.Manhattan norm (sum of the absolute values of the arguments).Maximum norm (maximum of the absolute values of the arguments).Alias forL1.Alias forLINF. -
Method Summary
Modifier and TypeMethodDescriptionfinal doubleof(double[] v) Computes the norm.final doubleof(double x, double y) Computes the norm.final doubleof(double x, double y, double z) Computes the norm.static NormReturns 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.
-
Enum Constant Details
-
L1
Manhattan norm (sum of the absolute values of the arguments). -
MANHATTAN
Alias forL1. -
L2
-
EUCLIDEAN
Alias forL2. -
LINF
Maximum norm (maximum of the absolute values of the arguments). -
MAXIMUM
Alias forLINF.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
of
Computes the norm.Special cases:
- If either value is
Double.NaN, then the result isDouble.NaN. - If either value is infinite and the other value is not
Double.NaN, then the result isDouble.POSITIVE_INFINITY.
- Parameters:
x- Argument.y- Argument.- Returns:
- the norm.
- If either value is
-
of
Computes the norm.Special cases:
- If any value is
Double.NaN, then the result isDouble.NaN. - If any value is infinite and no value is not
Double.NaN, then the result isDouble.POSITIVE_INFINITY.
- Parameters:
x- Argument.y- Argument.z- Argument.- Returns:
- the norm.
- If any value is
-
of
Computes the norm.Special cases:
- If any value is
Double.NaN, then the result isDouble.NaN. - If any value is infinite and no value is not
Double.NaN, then the result isDouble.POSITIVE_INFINITY.
- Parameters:
v- Argument.- Returns:
- the norm.
- Throws:
IllegalArgumentException- if the array is empty.
- If any value is
-