[mlpack] 254/324: Fix error in random sample generation.
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Sun Aug 17 08:22:16 UTC 2014
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch svn-trunk
in repository mlpack.
commit 59527ad15fab6e3e89af77535dc3d03c8ca71819
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Fri Aug 1 16:30:43 2014 +0000
Fix error in random sample generation.
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16933 9d5b8971-822b-0410-80eb-d18c1038ef23
---
src/mlpack/core/dists/laplace_distribution.hpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/mlpack/core/dists/laplace_distribution.hpp b/src/mlpack/core/dists/laplace_distribution.hpp
index 63aa7f4..59fa17f 100644
--- a/src/mlpack/core/dists/laplace_distribution.hpp
+++ b/src/mlpack/core/dists/laplace_distribution.hpp
@@ -93,12 +93,10 @@ class LaplaceDistribution
// elementwise.
for (size_t i = 0; i < result.n_elem; ++i)
{
- if (result[i] < 0)
- result[i] = mean[i] + scale * result[i] * std::log(1 + 2.0 * (result[i]
- - 0.5));
+ if (result[i] < 0.5)
+ result[i] = mean[i] + scale * std::log(1 + 2.0 * (result[i] - 0.5));
else
- result[i] = mean[i] - scale * result[i] * std::log(1 - 2.0 * (result[i]
- - 0.5));
+ result[i] = mean[i] - scale * std::log(1 - 2.0 * (result[i] - 0.5));
}
return result;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list