Package dev.nm.number.doublearray
Class DoubleArrayMath
- java.lang.Object
-
- dev.nm.number.doublearray.DoubleArrayMath
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double[]
abs(double[] doubles)
Get the absolute values.static double[]
add(double[] doubles, double value)
Add a double value to each element in an array.static double[]
exp(double[] doubles)
Get the exponentials of values.static double[]
expm1(double[] doubles)
Get the exponential-minus-one (ex - 1) of values.static double[]
log(double[] doubles)
Get the logs of values.static double
max(double... doubles)
Get the maximum of the values.static int
max(int... integers)
Get the maximum of the values.static double
min(double... doubles)
Get the minimum of the values.static double[]
pow(double[] doubles, double exponent)
Raise each element in an array to the power of the given exponent.static double[]
reciprocal(double[] doubles)
Get the reciprocals of values.static double[]
scale(double[] doubles, double multiplier)
Scale each element in an array by a multiplier.static double[]
signum(double[] doubles)
Get the signs of values.static double[]
sqrt(double[] doubles)
Get the square roots of values.static double
sum(double... doubles)
Get the sum of the values.static int
sum(int... integers)
Get the sum of the values.static double
sum2(double... doubles)
Get the sum of squares of the values.
-
-
-
Method Detail
-
min
public static double min(double... doubles)
Get the minimum of the values.- Parameters:
doubles
- an array of doubles- Returns:
- the smallest of the inputs
-
max
public static double max(double... doubles)
Get the maximum of the values.- Parameters:
doubles
- an array of doubles- Returns:
- the biggest of the inputs
-
max
public static int max(int... integers)
Get the maximum of the values.- Parameters:
integers
- an array of ints- Returns:
- the biggest of the inputs
-
abs
public static double[] abs(double[] doubles)
Get the absolute values.- Parameters:
doubles
- an array of doubles- Returns:
- the absolute values of the inputs
-
sum
public static double sum(double... doubles)
Get the sum of the values.- Parameters:
doubles
- an array of doubles- Returns:
- the sum of the inputs
-
sum
public static int sum(int... integers)
Get the sum of the values.- Parameters:
integers
- an array of ints- Returns:
- the sum of the inputs
-
sum2
public static double sum2(double... doubles)
Get the sum of squares of the values.- Parameters:
doubles
- an array of doubles- Returns:
- the sum of squares of the inputs
-
log
public static double[] log(double[] doubles)
Get the logs of values.- Parameters:
doubles
- an array of doubles- Returns:
- the logs of the inputs
-
exp
public static double[] exp(double[] doubles)
Get the exponentials of values.- Parameters:
doubles
- an array of doubles- Returns:
- the exponentials of the inputs
-
expm1
public static double[] expm1(double[] doubles)
Get the exponential-minus-one (ex - 1) of values.- Parameters:
doubles
- an array of doubles- Returns:
- the exponential-minus-one of the inputs
-
signum
public static double[] signum(double[] doubles)
Get the signs of values.- Parameters:
doubles
- an array of doubles- Returns:
- the signs of the inputs
-
sqrt
public static double[] sqrt(double[] doubles)
Get the square roots of values.- Parameters:
doubles
- an array of doubles- Returns:
- the square roots of the inputs
-
reciprocal
public static double[] reciprocal(double[] doubles)
Get the reciprocals of values.- Parameters:
doubles
- an array of doubles- Returns:
- the reciprocals of the inputs
-
add
public static double[] add(double[] doubles, double value)
Add a double value to each element in an array.- Parameters:
doubles
- the double arrayvalue
- the value to be added- Returns:
- the double array with the value added
-
scale
public static double[] scale(double[] doubles, double multiplier)
Scale each element in an array by a multiplier.- Parameters:
doubles
- the double arraymultiplier
- the multiplier- Returns:
- the double array with the value scaled
-
pow
public static double[] pow(double[] doubles, double exponent)
Raise each element in an array to the power of the given exponent.- Parameters:
doubles
- the double arrayexponent
- the exponent- Returns:
- the double array with the value power raised
-
-