Package org.apache.commons.math4.util
Class CentralPivotingStrategy
java.lang.Object
org.apache.commons.math4.util.CentralPivotingStrategy
- All Implemented Interfaces:
java.io.Serializable,PivotingStrategyInterface
public class CentralPivotingStrategy extends java.lang.Object implements PivotingStrategyInterface, java.io.Serializable
A mid point strategy based on the average of begin and end indices.
- Since:
- 3.4
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description CentralPivotingStrategy() -
Method Summary
Modifier and Type Method Description intpivotIndex(double[] work, int begin, int end)Find pivot index of the array so that partition and Kth element selection can be made
-
Constructor Details
-
CentralPivotingStrategy
public CentralPivotingStrategy()
-
-
Method Details
-
pivotIndex
Find pivot index of the array so that partition and Kth element selection can be made This in particular picks a average of begin and end indices- Specified by:
pivotIndexin interfacePivotingStrategyInterface- Parameters:
work- data arraybegin- index of the first element of the sliceend- index after the last element of the slice- Returns:
- The index corresponding to a simple average of the first and the last element indices of the array slice
- Throws:
MathIllegalArgumentException- when indices exceeds range
-