Repository: commons-math Updated Branches: refs/heads/master b645f5d08 -> dff1a0953
MATH-1382: Unnecessary copying. Thanks to Stefan Bunk for the report and fix. Closes #42 Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/dff1a095 Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/dff1a095 Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/dff1a095 Branch: refs/heads/master Commit: dff1a0953d97d46290750a46d01be1e1519ae698 Parents: b645f5d Author: Gilles <er...@apache.org> Authored: Tue May 2 01:18:35 2017 +0200 Committer: Gilles <er...@apache.org> Committed: Tue May 2 01:18:35 2017 +0200 ---------------------------------------------------------------------- src/changes/changes.xml | 4 ++++ .../math4/distribution/MultivariateNormalDistribution.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/dff1a095/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3a9ac48..d8dbd44 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -54,6 +54,10 @@ If the output is not quite correct, check for invisible trailing spaces! </release> <release version="4.0" date="XXXX-XX-XX" description=""> + <action dev="erans" type="fix" issue="MATH-1382" due-to="Stefan Bunk"> + "MultivariateNormalDistribution": performance improvement (by + removing unnecessary copying). + </action> <action dev="erans" type="fix" issue="MATH-1405" due-to="Daniil Finkel"> "KolmogorovSmirnovTest": bug in "fixTies". </action> http://git-wip-us.apache.org/repos/asf/commons-math/blob/dff1a095/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java index 097caa0..52df408 100644 --- a/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java @@ -211,7 +211,7 @@ public class MultivariateNormalDistribution private double getExponentTerm(final double[] values) { final double[] centered = new double[values.length]; for (int i = 0; i < centered.length; i++) { - centered[i] = values[i] - getMeans()[i]; + centered[i] = values[i] - means[i]; } final double[] preMultiplied = covarianceMatrixInverse.preMultiply(centered); double sum = 0;