Maciej Fijalkowski avatar Maciej Fijalkowski committed 437d9d1

simplification, a new (and unused) class and some comments

Comments (0)

Files changed (1)


         dtype.setitem_w(space,, i, w_elem)
     return arr
+class ArrayIndex(object):
+    """ An index into an array or view. Offset is a data offset, indexes
+    are respective indexes in dimensions
+    """
+    def __init__(self, indexes, offset):
+        self.indexes = indexes
+        self.offset = offset
 class BaseArray(Wrappable):
     _attrs_ = ["invalidates", "signature", "shape"]
             item += v
         return item
-    def len_of_shape(self):
-        return len(self.shape)
     def get_root_shape(self):
         return self.shape
         """ The result of getitem/setitem is a single item if w_idx
         is a list of scalars that match the size of shape
-        shape_len = self.len_of_shape()
+        shape_len = len(self.shape)
         if shape_len == 0:
             if not space.isinstance_w(w_idx, space.w_int):
                 raise OperationError(space.w_IndexError, space.wrap(
     def __init__(self, parent, signature, chunks, shape):
         ViewArray.__init__(self, parent, signature, shape)
         self.chunks = chunks
-        self.shape_reduction = 0
-        for chunk in chunks:
-            if chunk[-2] == 0:
-                self.shape_reduction += 1
     def get_root_storage(self):
         return self.parent.get_concrete().get_root_storage()
     def setitem(self, item, value):
         self.parent.setitem(self.calc_index(item), value)
-    def len_of_shape(self):
-        return self.parent.len_of_shape() - self.shape_reduction
     def get_root_shape(self):
         return self.parent.get_root_shape()
 class NDimArray(BaseArray):
+    """ A class representing contiguous array. We know that each iteration
+    by say ufunc will increase the data index by one
+    """
     def __init__(self, size, shape, dtype):
         BaseArray.__init__(self, shape)
         self.size = size
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
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.