Package org.hipparchus.util
Enum PivotingStrategy
- java.lang.Object
-
- java.lang.Enum<PivotingStrategy>
-
- org.hipparchus.util.PivotingStrategy
-
- All Implemented Interfaces:
Serializable
,Comparable<PivotingStrategy>
public enum PivotingStrategy extends Enum<PivotingStrategy>
A strategy to pick a pivoting index of an array for doing partitioning.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CENTRAL
A mid point strategy based on the average of begin and end indices.MEDIAN_OF_3
Classic median of 3 strategy given begin and end indices.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
pivotIndex(double[] work, int begin, int end)
Find pivot index of the array so that partition and Kth element selection can be madestatic PivotingStrategy
valueOf(String name)
Returns the enum constant of this type with the specified name.static PivotingStrategy[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 Detail
-
values
public static PivotingStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PivotingStrategy c : PivotingStrategy.values()) System.out.println(c);
- 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 nameNullPointerException
- 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 arraybegin
- index of the first element of the sliceend
- 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
-
-