[arrayfire] 208/408: Cleaning up multiply_inplace in cpu backend

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:59 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 0efb69a2f382adc6693e9cea5d15582ac99ee3fa
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Fri Aug 7 10:53:40 2015 -0400

    Cleaning up multiply_inplace in cpu backend
---
 src/backend/cpu/copy.cpp | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/src/backend/cpu/copy.cpp b/src/backend/cpu/copy.cpp
index 1900145..a2bb4ff 100644
--- a/src/backend/cpu/copy.cpp
+++ b/src/backend/cpu/copy.cpp
@@ -63,30 +63,6 @@ namespace cpu
         return out;
     }
 
-    template<typename T>
-    void multiply_inplace(Array<T> &in, double val)
-    {
-        dim4 idims       = in.dims();
-        dim4 istrides    = in.strides();
-        T *iptr = in.get();
-
-        for (dim_t l = 0; l < idims[3]; l++) {
-            dim_t off3 = l * istrides[3];
-
-            for (dim_t k = 0; k < idims[2]; k++) {
-                dim_t off2 = off3 + k * istrides[2];
-
-                for (dim_t j = 0; j < idims[1]; j++) {
-                    dim_t off1 = off2 + j * istrides[1];
-
-                    for (dim_t i = 0; i < idims[0]; i++) {
-                        iptr[off1 + i] *= val;
-                    }
-                }
-            }
-        }
-    }
-
     template<typename inType, typename outType>
     static void copy(Array<outType> &dst, const Array<inType> &src, outType default_value, double factor)
     {
@@ -135,6 +111,11 @@ namespace cpu
         }
     }
 
+    template<typename T>
+    void multiply_inplace(Array<T> &in, double val)
+    {
+        copy<T, T>(in, in, 0, val);
+    }
 
     template<typename inType, typename outType>
     Array<outType>

-- 
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