Package es.upm.etsisi.cf4j.util
Class Maths
- java.lang.Object
-
- es.upm.etsisi.cf4j.util.Maths
-
public class Maths extends Object
This class contains useful math methods.
-
-
Constructor Summary
Constructors Constructor Description Maths()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
arrayAverage(double[] array)
Calculates the average of an double arraystatic double
arrayAverage(int[] array)
Calculates the average of an int arraystatic double
arrayStandardDeviation(double[] array)
Calculates the standard deviation of an double arraystatic double
arrayStandardDeviation(int[] array)
Calculate the standard deviation of an int arraystatic double
dotProduct(double[] a, double[] b)
Dot product between two vectorsstatic double
log(double x, double b)
Returns the log in an specific basestatic double
logistic(double x)
Returns the logistic function g(x)
-
-
-
Method Detail
-
arrayAverage
public static double arrayAverage(double[] array)
Calculates the average of an double array- Parameters:
array
- Array of double from which to calculate the mean- Returns:
- Array mean
-
arrayStandardDeviation
public static double arrayStandardDeviation(double[] array)
Calculates the standard deviation of an double array- Parameters:
array
- Array of double from which to calculate the standard deviation- Returns:
- Standard deviation of the array
-
arrayAverage
public static double arrayAverage(int[] array)
Calculates the average of an int array- Parameters:
array
- Array of int from which to calculate the mean- Returns:
- Array mean
-
arrayStandardDeviation
public static double arrayStandardDeviation(int[] array)
Calculate the standard deviation of an int array- Parameters:
array
- Array of int from which to calculate the standard deviation- Returns:
- Standard deviation of the array
-
dotProduct
public static double dotProduct(double[] a, double[] b)
Dot product between two vectors- Parameters:
a
- Vector Ab
- Vector B- Returns:
- dot_product(A, B)
-
log
public static double log(double x, double b)
Returns the log in an specific base- Parameters:
x
- Valueb
- Base- Returns:
- log of x in base b
-
logistic
public static double logistic(double x)
Returns the logistic function g(x)- Parameters:
x
- The given parameter x of the function g(x)- Returns:
- Value of the logistic function g(x)
-
-