Class Integers

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void abs​(int[] array)
      Changes all values to their absolute values.
      static double arithmeticMean​(int[] array)
      Computes the arithmetic mean of the array.
      static double arithmeticMean​(int[] array, int start, int end)
      Computes the arithmetic mean of a portion of an array.
      static boolean isPowerOfTwo​(int number)
      Indicates whether a number is a power of two.
      static int max​(int[] array)
      Calculates the min value of a given array.
      static float maximalAccumulatedSimilarity​(int[] x, int[] y, DistanceFunction<Integer> similarityFunction)
      Computes the dynamic timewarping similarity (i.e.
      static int maxIndex​(int[] array)
      Calculates the index of the max value of a given array.
      static int maxIndex​(int[] array, int offset, int length)
      Calculates the index of the max value of a given array.
      static int[] maxIndices​(int[] array)
      Calculates the indices of the max values of a given array in descending value order.
      static int[] maxIndices​(int[] array, int offset, int length)
      Calculates the indices of the max values of a given array in descending value order.
      static int min​(int[] array)
      Calculates the min value of a given array.
      static float minimalAccumulatedDistance​(int[] x, int[] y, DistanceFunction<Integer> distanceFunction)
      Computes the dynamic timewarping distance (i.e.
      static void normalize​(int[][] arrayOfArrays, int scale)
      Normalizes the values in the given arrays to values 0..scale.
      static void normalize​(int[] array, int scale)
      Normalizes the values in the given array to values 0..scale.
      static int[] peaks​(int[] array, int interval, boolean strict)
      Calculates all peaks in the given array.
      static void reverse​(int[] array)
      Reverses the order of the ints in place.
      static float standardDeviation​(int[] data)  
      static float standardDeviation​(int[] data, int offset, int length)  
      static float variance​(int[] array)  
      static float variance​(int[] array, int offset, int length)  
    • Method Detail

      • reverse

        public static void reverse​(int[] array)
        Reverses the order of the ints in place.
        Parameters:
        array - int array
      • arithmeticMean

        public static double arithmeticMean​(int[] array,
                                            int start,
                                            int end)
        Computes the arithmetic mean of a portion of an array.
        Parameters:
        array - array
        start - first index (incl)
        end - last index (excl)
        Returns:
        mean
      • arithmeticMean

        public static double arithmeticMean​(int[] array)
        Computes the arithmetic mean of the array.
        Parameters:
        array - array
        Returns:
        mean
      • variance

        public static float variance​(int[] array)
      • variance

        public static float variance​(int[] array,
                                     int offset,
                                     int length)
      • standardDeviation

        public static float standardDeviation​(int[] data)
      • standardDeviation

        public static float standardDeviation​(int[] data,
                                              int offset,
                                              int length)
      • abs

        public static void abs​(int[] array)
        Changes all values to their absolute values.
        Parameters:
        array - integer array
      • min

        public static int min​(int[] array)
        Calculates the min value of a given array.
        Parameters:
        array - integer array
        Returns:
        minimum
      • max

        public static int max​(int[] array)
        Calculates the min value of a given array.
        Parameters:
        array - integer array
        Returns:
        max
      • maxIndex

        public static int maxIndex​(int[] array,
                                   int offset,
                                   int length)
        Calculates the index of the max value of a given array.
        Parameters:
        array - int array
        offset - offset into the array
        length - length
        Returns:
        max
      • maxIndices

        public static int[] maxIndices​(int[] array)
        Calculates the indices of the max values of a given array in descending value order.
        Parameters:
        array - int array
        Returns:
        max indices
      • maxIndices

        public static int[] maxIndices​(int[] array,
                                       int offset,
                                       int length)
        Calculates the indices of the max values of a given array in descending value order.
        Parameters:
        array - int array
        offset - offset into the array
        length - length
        Returns:
        max indices
      • peaks

        public static int[] peaks​(int[] array,
                                  int interval,
                                  boolean strict)
        Calculates all peaks in the given array. A peak is defined as a value with at least interval values to its left that are strictly less than their direct neighbors to the right, and at least interval values to its right that are strictly less than their direct neighbors to the left.
        Parameters:
        array - array
        interval - number of values to the left and the right that the function has to be increasing or decreasing
        strict - if true, the shoulders of the peak must be strictly monotonically increasing or decreasing
        Returns:
        indices of the detected peaks
      • maxIndex

        public static int maxIndex​(int[] array)
        Calculates the index of the max value of a given array.
        Parameters:
        array - int array
        Returns:
        max
      • normalize

        public static void normalize​(int[] array,
                                     int scale)
        Normalizes the values in the given array to values 0..scale. Note: This method manipulates the provided array.
        Parameters:
        array - array of integers
        scale - scale
      • normalize

        public static void normalize​(int[][] arrayOfArrays,
                                     int scale)
        Normalizes the values in the given arrays to values 0..scale. Note: This method manipulates the provided array.
        Parameters:
        arrayOfArrays - array of double arrays
        scale - scale
      • isPowerOfTwo

        public static boolean isPowerOfTwo​(int number)
        Indicates whether a number is a power of two.
        Parameters:
        number - number
        Returns:
        true, if this number is a power of two (e.g. 4, 8, 16, ...)
      • minimalAccumulatedDistance

        public static float minimalAccumulatedDistance​(int[] x,
                                                       int[] y,
                                                       DistanceFunction<Integer> distanceFunction)
        Computes the dynamic timewarping distance (i.e. accumulated cost) between two integer sequences using a given cost function.
        Parameters:
        x - sequence
        y - sequence
        distanceFunction - used to compute the local distance between two elements of each sequence
        Returns:
        total cost of the optimal (i.e. minimal w.r.t cost) warping path between x and y
      • maximalAccumulatedSimilarity

        public static float maximalAccumulatedSimilarity​(int[] x,
                                                         int[] y,
                                                         DistanceFunction<Integer> similarityFunction)
        Computes the dynamic timewarping similarity (i.e. accumulated similarity) between two integer sequences using a given similarity function.
        Parameters:
        x - sequence
        y - sequence
        similarityFunction - used to compute the local distance between two elements of each sequence
        Returns:
        total similarity of the optimal (i.e. maximal w.r.t. similarity) warping path between x and y