commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (MATH-815) Multivariate Normal Distribution
Date Mon, 23 Jul 2012 23:56:34 GMT


Gilles commented on MATH-815:

* Usage of "System.err" instead of raising an exception.
* I prefer "MathArrays.copyOf" instead of "System.arraycopy"
* Why do you store "inverseSigma" as "double[][]" and "sigma" as "RealMatrix"?
* In the method "getSigma" you return a "clone", which will perform a shallow copy.
* Method {{density}} should probably be written as:
public double density(final double[] vals)
        throws DimensionMismatchException {
    if (vals.length != numColumns) {
        throw new DimensionMismatchException(vals.length, numColumns);

    final double kernel = getKernel(vals, mu, inverseSigma);
    final double denom = FastMath.pow(2 * Math.PI, numColumns / 2) *
                         FastMath.sqrt(sigmaDeterminant)) *
    final double prob = 1d / denom;
    return prob;
* All calls to "Math" methods should be replaced by the equivalent call to "FastMath".
* Whenever possible, variables must be declared and assigned in the same statement (cf. lines
222 and 229 in "").
* "private" methods must also be commented.
* Computation in lines 116-119 ("") is probably more efficient
if written as:
for (int row = 0; row < numColumns; row++) {
    final double factor = FastMath.sqrt(sigmaEigenvalues[row]);
    for (int col = 0; col < numColumns; col++) {

> Multivariate Normal Distribution
> --------------------------------
>                 Key: MATH-815
>                 URL:
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Jared Becksfort
>            Priority: Minor
>         Attachments: mvn.tgz, patch
>   Original Estimate: 1m
>  Remaining Estimate: 1m
> I will submit a class for Multivariate Normal Distributions.  Not sure if it will allow
sampling initially.
> > Hello,
> >
> > I have implemented some classes for multivariate Normal distributions, multivariate
normal mixture models, and an expectation maximization fitting class for the mixture model.
 I would like to submit it to Apache Commons Math.  I still have some touching up to do so
that they fit the style guidelines and implement the correct interfaces.  Before I do so,
I thought I would at least ask if the developers of the project are interested in me submitting
> >
> > Thanks,
> > Jared Becksfort
> Dear Jared,
> Yes, that would be very nice to have such an addition! Remember to also include unit
tests (refer to the current ones for examples). The best would be to split a submission up
into multiple minor ones, each covering a natural submission (e.g. multivariate Normal distribution
in one submission), and create an issue as described at
> If you run into any problems, please do not hesitate to ask on this mailing list.
> Cheers, Mikkel.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message