Class Median
- All Implemented Interfaces:
Serializable, UnivariateStatistic, MathArrays.Function
Percentile for a description of the algorithm used.
Note that this implementation is not synchronized. If
multiple threads access an instance of this class concurrently, and at least
one of the threads invokes the increment() or
clear() method, it must be synchronized externally.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Percentile
Percentile.EstimationType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final doubleFixed quantile.private static final longSerializable version identifier -
Constructor Summary
ConstructorsModifierConstructorDescriptionMedian()Default constructor.Copy constructor, creates a newMedianidentical to theoriginalprivateMedian(Percentile.EstimationType estimationType, NaNStrategy nanStrategy, KthSelector kthSelector) Constructs a Median with the specificPercentile.EstimationType,NaNStrategyand.invalid reference
PivotingStrategy -
Method Summary
Modifier and TypeMethodDescriptionwithEstimationType(Percentile.EstimationType newEstimationType) Build a new instance similar to the current one except for theestimation type.withKthSelector(KthSelector newKthSelector) Build a new instance similar to the current one except for thekthSelectorinstance specifically set.withNaNStrategy(NaNStrategy newNaNStrategy) Build a new instance similar to the current one except for theNaN handlingstrategy.Methods inherited from class Percentile
copy, copy, evaluate, evaluate, evaluate, evaluate, getEstimationType, getKthSelector, getNaNStrategy, getPivotingStrategy, getQuantile, getWorkArray, medianOf3, setData, setData, setQuantileMethods inherited from class AbstractUnivariateStatistic
evaluate, evaluate, getData, getDataRef, test, test, test, test
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerializable version identifier- See Also:
-
FIXED_QUANTILE_50
private static final double FIXED_QUANTILE_50Fixed quantile.- See Also:
-
-
Constructor Details
-
Median
public Median()Default constructor. -
Median
Copy constructor, creates a newMedianidentical to theoriginal- Parameters:
original- theMedianinstance to copy- Throws:
NullArgumentException- if original is null
-
Median
private Median(Percentile.EstimationType estimationType, NaNStrategy nanStrategy, KthSelector kthSelector) throws MathIllegalArgumentException Constructs a Median with the specificPercentile.EstimationType,NaNStrategyand.invalid reference
PivotingStrategy- Parameters:
estimationType- one of the percentileestimation typesnanStrategy- one ofNaNStrategyto handle with NaNskthSelector-KthSelectorto use for pivoting during search- Throws:
MathIllegalArgumentException- if p is not within (0,100]NullArgumentException- if type or NaNStrategy passed is null
-
-
Method Details
-
withEstimationType
Build a new instance similar to the current one except for theestimation type.This method is intended to be used as part of a fluent-type builder pattern. Building finely tune instances should be done as follows:
Percentile customized = new Percentile(quantile). withEstimationType(estimationType). withNaNStrategy(nanStrategy). withKthSelector(kthSelector);If any of the
withXxxmethod is omitted, the default value for the corresponding customization parameter will be used.- Overrides:
withEstimationTypein classPercentile- Parameters:
newEstimationType- estimation type for the new instance- Returns:
- a new instance, with changed estimation type
-
withNaNStrategy
Build a new instance similar to the current one except for theNaN handlingstrategy.This method is intended to be used as part of a fluent-type builder pattern. Building finely tune instances should be done as follows:
Percentile customized = new Percentile(quantile). withEstimationType(estimationType). withNaNStrategy(nanStrategy). withKthSelector(kthSelector);If any of the
withXxxmethod is omitted, the default value for the corresponding customization parameter will be used.- Overrides:
withNaNStrategyin classPercentile- Parameters:
newNaNStrategy- NaN strategy for the new instance- Returns:
- a new instance, with changed NaN handling strategy
-
withKthSelector
Build a new instance similar to the current one except for thekthSelectorinstance specifically set.This method is intended to be used as part of a fluent-type builder pattern. Building finely tune instances should be done as follows:
Percentile customized = new Percentile(quantile). withEstimationType(estimationType). withNaNStrategy(nanStrategy). withKthSelector(newKthSelector);If any of the
withXxxmethod is omitted, the default value for the corresponding customization parameter will be used.- Overrides:
withKthSelectorin classPercentile- Parameters:
newKthSelector- KthSelector for the new instance- Returns:
- a new instance, with changed KthSelector
-