commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bunk (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MATH-1382) MultivariateNormalDistribution.density() unnecessarily copies means array in loop
Date Thu, 04 Aug 2016 08:58:20 GMT
Stefan Bunk created MATH-1382:
---------------------------------

             Summary: MultivariateNormalDistribution.density() unnecessarily copies means
array in loop
                 Key: MATH-1382
                 URL: https://issues.apache.org/jira/browse/MATH-1382
             Project: Commons Math
          Issue Type: Improvement
    Affects Versions: 3.6.1
            Reporter: Stefan Bunk
            Priority: Trivial


In the class MultivariateNormalDistribution, the public method density() calls the private
method getExponentTerm(), which first centers the given instance by the mean.
However, it is using the method getMeans(), which creates a copy of means array each time,
just for reading the i-th index.
See https://github.com/apache/commons-math/blob/3.6.1-release/src/main/java/org/apache/commons/math3/distribution/MultivariateNormalDistribution.java#L238

A solution should use the private variable `means` directly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message