From 6cb543e5dc2b0390983804fe79b0518b6b9ff5d2 Mon Sep 17 00:00:00 2001
From: Alexander Harvey Nitz <ahnitz@syr.edu>
Date: Tue, 24 Jul 2012 16:32:17 -0400
Subject: [PATCH] allow imul to act on gpuarray

---
 pycuda/gpuarray.py |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pycuda/gpuarray.py b/pycuda/gpuarray.py
index 937afee..61707fa 100644
--- a/pycuda/gpuarray.py
+++ b/pycuda/gpuarray.py
@@ -450,8 +450,11 @@ class GPUArray(object):
         result = self._new_like_me()
         return self._axpbz(scalar, 0, result)
 
-    def __imul__(self, scalar):
-        return self._axpbz(scalar, 0, self)
+    def __imul__(self, other):
+        if isinstance(other, GPUArray):
+            return self._elwise_multiply(other, self)
+        else:
+            return self._axpbz(other, 0, self)
 
     def __div__(self, other):
         """Divides an array by an array or a scalar::
-- 
1.7.10.rc4.209.g0677f

