[arrayfire] 138/408: BUGFIX: Fixing a bug in randn for CPU backend

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit 1bde87148571ec6ccb0e229e0474923587b3e77b
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Mon Jul 13 13:55:40 2015 -0400

    BUGFIX: Fixing a bug in randn for CPU backend
    
    - The function was improperly creating identical arrays every time
---
 src/backend/cpu/random.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/backend/cpu/random.cpp b/src/backend/cpu/random.cpp
index 03fabb3..71de4ef 100644
--- a/src/backend/cpu/random.cpp
+++ b/src/backend/cpu/random.cpp
@@ -86,11 +86,14 @@ Array<T> randn(const af::dim4 &dims)
 
     if (my_seed != gen_seed) {
         gen = nrand<T>(generator);
+        my_seed = gen_seed;
     }
 
     Array<T> outArray = createEmptyArray<T>(dims);
     T *outPtr = outArray.get();
-    generate(outPtr, outPtr + outArray.elements(), gen);
+    for (int i = 0; i < (int)outArray.elements(); i++) {
+        outPtr[i] = gen();
+    }
     return outArray;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list