Top Description Fields Constructors Methods
org.apache.commons.math3.util

public Class MedianOf3PivotingStrategy

extends Object
implements PivotingStrategyInterface, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.math3.util.PivotingStrategyInterface
Imports
java.io.Serializable, org.apache.commons.math3.exception.MathIllegalArgumentException

Classic median of 3 strategy given begin and end indices.
Since
3.4

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Serializable UID.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The index corresponding to a pivot chosen between the first, middle and the last indices of the array slice
pivotIndex
(final double[]
data array
work
,
final int
index of the first element of the slice
begin
,
final int
index after the last element of the slice
end
)

Implements org.apache.commons.math3.util.PivotingStrategyInterface.pivotIndex.

Find pivot index of the array so that partition and Kth element selection can be made This in specific makes use of median of 3 pivoting.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Serializable UID.

Constructor Detail

MedianOf3PivotingStrategyback to summary
public MedianOf3PivotingStrategy()

Method Detail

pivotIndexback to summary
public int pivotIndex(final double[] work, final int begin, final int end) throws MathIllegalArgumentException

Implements org.apache.commons.math3.util.PivotingStrategyInterface.pivotIndex.

Doc from org.apache.commons.math3.util.PivotingStrategyInterface.pivotIndex.

Find pivot index of the array so that partition and Kth element selection can be made This in specific makes use of median of 3 pivoting.

Parameters
work:double[]

data array

begin:int

index of the first element of the slice

end:int

index after the last element of the slice

Returns:int

The index corresponding to a pivot chosen between the first, middle and the last indices of the array slice

Exceptions
MathIllegalArgumentException:
when indices exceeds range