Documentation of 'org.matheclipse.combinatoric.util.ArrayUtils' Java class
ArrayUtils
org.matheclipse.combinatoric.util

Class ArrayUtils



  • public final class ArrayUtils
    extends java.lang.Object
    Provides a couple of static utility methods for creating and initializing arrays used throughout permutation and combination generation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int[] deleteSubset(int[] multiset, int[] subset)
      Iterate over the elements in the subset and set the first elements to -1 in the multiset which equals the subset elements.
      static int[] identityPermutation(int n)
      Creates and fills an array with a[i] = i.
      static void identityPermutation(int[] a)
      Fills the given array with a[i] = i.
      static char[] valuesAt(char[] elements, int[] indices) 
      static int[] valuesAt(int[] elements, int[] indices) 
      static <T> T[] valuesAt(T[] elements, int[] indices) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • deleteSubset

        public static int[] deleteSubset(int[] multiset,
                                         int[] subset)
        Iterate over the elements in the subset and set the first elements to -1 in the multiset which equals the subset elements. Return a new reduced multiset int[] array where the -1 values are deleted.
        Parameters:
        multiset - a multiset containing equals or greater than elements as the subset.
        subset - a subset with the elements which should be deleted.
        Returns:
      • identityPermutation

        public static void identityPermutation(int[] a)
        Fills the given array with a[i] = i. For example, if a = int[4], then fills a with { 0, 1, 2, 3 }. Used throughout permutation and combination generation as the first result (lexicographically).
        Parameters:
        a - an array
      • identityPermutation

        public static int[] identityPermutation(int n)
        Creates and fills an array with a[i] = i. For example, if n = 4, then returns { 0, 1, 2, 3 }. Used throughout permutation and combination generation as the first result (lexicographically).
        Parameters:
        n - the size of the array
        Returns:
        the initialized array
      • valuesAt

        public static char[] valuesAt(char[] elements,
                                      int[] indices)
        Parameters:
        elements - the elements to choose from
        indices - the array of indices
        Returns:
        the mapped array
      • valuesAt

        public static int[] valuesAt(int[] elements,
                                     int[] indices)
        Parameters:
        elements - the elements to choose from
        indices - the array of indices
        Returns:
        the mapped array
      • valuesAt

        public static <T> T[] valuesAt(T[] elements,
                                       int[] indices)
        Type Parameters:
        T - a type
        Parameters:
        elements - the elements to choose from
        indices - the array of indices
        Returns:
        the mapped array

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.