/** * Returns the sample mode(s). The mode is the most frequently occurring * value in the sample. If there is a unique value with maximum frequency, * this value is returned as the only element of the output array. Otherwise, * the returned array contains the maximum frequency elements in increasing * order. For example, if {@code sample} is {0, 12, 5, 6, 0, 13, 5, 17}, * the returned array will have length two, with 0 in the first element and * 5 in the second. * * <p>NaN values are ignored when computing the mode - i.e., NaNs will never * appear in the output array. If the sample includes only NaNs or has * length 0, an empty array is returned.</p> * * @param sample input data * @return array of array of the most frequently occurring element(s) sorted in ascending order. * @throws MathIllegalArgumentException if the indices are invalid or the array is null * @since 3.3 */ public static double[] mode(double[] sample) throws MathIllegalArgumentException { if (sample == null) { throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY); } return getMode(sample, 0, sample.length); }
return getMode(sample, begin, length);
/** * Returns the sample mode(s). The mode is the most frequently occurring * value in the sample. If there is a unique value with maximum frequency, * this value is returned as the only element of the output array. Otherwise, * the returned array contains the maximum frequency elements in increasing * order. For example, if {@code sample} is {0, 12, 5, 6, 0, 13, 5, 17}, * the returned array will have length two, with 0 in the first element and * 5 in the second. * * <p>NaN values are ignored when computing the mode - i.e., NaNs will never * appear in the output array. If the sample includes only NaNs or has * length 0, an empty array is returned.</p> * * @param sample input data * @return array of array of the most frequently occurring element(s) sorted in ascending order. * @throws MathIllegalArgumentException if the indices are invalid or the array is null * @since 3.3 */ public static double[] mode(double[] sample) throws MathIllegalArgumentException { if (sample == null) { throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY); } return getMode(sample, 0, sample.length); }
/** * Returns the sample mode(s). The mode is the most frequently occurring * value in the sample. If there is a unique value with maximum frequency, * this value is returned as the only element of the output array. Otherwise, * the returned array contains the maximum frequency elements in increasing * order. For example, if {@code sample} is {0, 12, 5, 6, 0, 13, 5, 17}, * the returned array will have length two, with 0 in the first element and * 5 in the second. * * <p>NaN values are ignored when computing the mode - i.e., NaNs will never * appear in the output array. If the sample includes only NaNs or has * length 0, an empty array is returned.</p> * * @param sample input data * @return array of array of the most frequently occurring element(s) sorted in ascending order. * @throws MathIllegalArgumentException if the indices are invalid or the array is null * @since 3.3 */ public static double[] mode(double[] sample) throws MathIllegalArgumentException { if (sample == null) { throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY); } return getMode(sample, 0, sample.length); }
return getMode(sample, begin, length);
return getMode(sample, begin, length);