Enum PivotingStrategy

java.lang.Object
java.lang.Enum<PivotingStrategy>
org.hipparchus.util.PivotingStrategy
All Implemented Interfaces:
Serializable, Comparable<PivotingStrategy>, java.lang.constant.Constable

public enum PivotingStrategy extends Enum<PivotingStrategy>
A strategy to pick a pivoting index of an array for doing partitioning.
  • Enum Constant Details

    • CENTRAL

      public static final PivotingStrategy CENTRAL
      A mid point strategy based on the average of begin and end indices.
    • MEDIAN_OF_3

      public static final PivotingStrategy MEDIAN_OF_3
      Classic median of 3 strategy given begin and end indices.
  • Method Details

    • values

      public static PivotingStrategy[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static PivotingStrategy valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • pivotIndex

      public abstract int pivotIndex(double[] work, int begin, int end) throws MathIllegalArgumentException
      Find pivot index of the array so that partition and Kth element selection can be made
      Parameters:
      work - data array
      begin - index of the first element of the slice
      end - index after the last element of the slice
      Returns:
      the index of the pivot element chosen between the first and the last element of the array slice
      Throws:
      MathIllegalArgumentException - when indices exceeds range