You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bunk (JIRA)" <ji...@apache.org> on 2016/08/04 08:58:20 UTC
[jira] [Created] (MATH-1382)
MultivariateNormalDistribution.density() unnecessarily copies means array
in loop
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)