Package org.hipparchus.util
Enum PivotingStrategy
- All Implemented Interfaces:
Serializable
,Comparable<PivotingStrategy>
,java.lang.constant.Constable
A strategy to pick a pivoting index of an array for doing partitioning.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionA mid point strategy based on the average of begin and end indices.Classic median of 3 strategy given begin and end indices. -
Method Summary
Modifier and TypeMethodDescriptionabstract 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
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 Details
-
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 Details
-
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
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
-