Commits

mattip committed 334c093

use orig_array properly in get_real, get_imag

Comments (0)

Files changed (2)

pypy/module/micronumpy/arrayimpl/concrete.py

         else:
             return None
     
-    def get_real(self):
+    def get_real(self, orig_array):
         strides = self.get_strides()
         backstrides = self.get_backstrides()
         if self.dtype.is_complex_type():
             dtype =  self.dtype.float_type
             return SliceArray(self.start, strides, backstrides,
-                          self.get_shape(), self, self, dtype=dtype)
+                          self.get_shape(), self, orig_array, dtype=dtype)
         return SliceArray(self.start, strides, backstrides, 
-                          self.get_shape(), self, self)
+                          self.get_shape(), self, orig_array)
 
-    def get_imag(self):
+    def get_imag(self, orig_array):
         strides = self.get_strides()
         backstrides = self.get_backstrides()
         if self.dtype.is_complex_type():
             dtype =  self.dtype.float_type
             return SliceArray(self.start + dtype.get_size(), strides, 
-                    backstrides, self.get_shape(), self, self, dtype=dtype)
+                    backstrides, self.get_shape(), self, orig_array, dtype=dtype)
         if self.dtype.is_flexible_type():
             # numpy returns self for self.imag
             return SliceArray(self.start, strides, backstrides,
-                    self.get_shape(), self, self)
+                    self.get_shape(), self, orig_array)
         impl = NonWritableArray(self.get_shape(), self.dtype, self.order, strides,
                              backstrides)
         impl.fill(self.dtype.box(0))
         self.strides = strides
         self.backstrides = backstrides
         self.shape = shape
-        assert isinstance(parent, BaseConcreteArray)
         if isinstance(parent, SliceArray):
             parent = parent.parent # one level only
         self.parent = parent

pypy/module/micronumpy/interp_numarray.py

         return W_NDimArray(self.implementation.copy())
 
     def descr_get_real(self, space):
-        return W_NDimArray(self.implementation.get_real())
+        return W_NDimArray(self.implementation.get_real(self))
 
     def descr_get_imag(self, space):
-        ret = self.implementation.get_imag()
+        ret = self.implementation.get_imag(self)
         if ret:
             return W_NDimArray(ret)
         raise OperationError(space.w_NotImplementedError, 
 
     def descr_set_real(self, space, w_value):
         # copy (broadcast) values into self
-        tmp = self.implementation.get_real()
+        tmp = self.implementation.get_real(self)
         tmp.setslice(space, convert_to_array(space, w_value))
 
     def descr_set_imag(self, space, w_value):
         if not self.get_dtype().is_complex_type():
             raise OperationError(space.w_TypeError, 
                     space.wrap('array does not have imaginary part to set'))
-        tmp = self.implementation.get_imag()
+        tmp = self.implementation.get_imag(self)
         tmp.setslice(space, convert_to_array(space, w_value))
 
     def descr_reshape(self, space, args_w):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.