Class MomUtils

java.lang.Object
jline.lib.mom.util.MomUtils

public final class MomUtils extends Object
MOM-specific utility functions for combinatorial operations Complements the existing jline.util.Maths class
  • Method Details

    • sortByNnzPos

      public static int[][] sortByNnzPos(int[][] combinations)
      Sort combinations by number of non-zeros and their positions. This is used to optimize the order of processing in the solver.
      Parameters:
      combinations - Array of combinations to sort
      Returns:
      Sorted array of combinations
    • countNonZeros

      public static int countNonZeros(int[] array)
      Count non-zero elements in an array.
      Parameters:
      array - The array to count non-zeros in
      Returns:
      Number of non-zero elements
    • hashPop

      public static int hashPop(int[] population, int[] maxPop)
      Hash a population vector to a unique index. This is used for efficient lookup of population states.
      Parameters:
      population - The population vector
      maxPop - Maximum population per class (for hash calculation)
      Returns:
      Hash index