commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [math] additions to MathArrays
Date Tue, 24 Nov 2015 14:11:20 GMT
On 24 November 2015 at 13:52, Phil Steitz <phil.steitz@gmail.com> wrote:
> I need the following methods to complete the fix for MATH-1246.  I
> can add them as private methods to the KS class; but they seem
> generally useful, so I propose adding them to MathArrays.  Any
> objections?
>
> /**
>   * Concatenates two arrays.
>   *
>   * @param x first array
>   * @param y second array
>   * @return a new array consisting of the entries of x followed by
> the entries of y
>   * @throws NullPointerException if either x or y is null
>   */
> public static double[] concat(double[] x, double[] y)

Could perhaps take a list?

> /**
>   * Returns an array consisting of the unique values in {@code data}.
>   * The return array is sorted in descending order.
>   *
>   * @param data
>   * @return descending list of values included in the input array
>   */
> public static double[] values(double[] data)

The name gives no hint that the output is unique.
IMO it should be renamed to reflect that.

[The sort order seems to be a byproduct of the algorithm used, so is
not particularly relevant to the name]

> /**
>   * Adds random jitter to {@code data} using deviates sampled from
> {@code dist}.
>   * <p>
>   * Note that jitter is applied in-place - i.e., the array
>   * values are overwritten with the result of applying jitter.</p>
>   *
>   * @param data input/output data array
>   * @param dist probability distribution to sample for jitter values
>   * @throws NullPointerException if either of the parameters is null
>   */
>  public static void jitter(double[] data, RealDistribution dist)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message