def visit_ArrayView(self, expr):
    typename = self.to_ctype(expr.type)
    data = self.visit_expr(expr.data)
    ndims = expr.type.rank 
    offset = self.visit_expr(expr.offset)
    count = self.visit_expr(expr.size)
    shape = self.visit_expr(expr.shape)
    strides = self.visit_expr(expr.strides)
  
    strides_elts = ["%s.elt%d" % (strides, i) for i in xrange(ndims)]
    shape_elts = ["%s.elt%d" % (shape, i) for i in xrange(ndims)]

    result = self.fresh_var(typename, "array_result")
    self.setfield(result, "data", data)
    self.setfield(result, "offset", offset)
    self.setfield(result, 'size', count)
    for i in xrange(ndims):
      self.setidx("%s.shape" % result, i, shape_elts[i])
      self.setidx("%s.strides" % result, i, strides_elts[i])
    return result
dataset/ETHPy150Open iskandr/parakeet/parakeet/c_backend/pymodule_compiler.py/PyModuleCompiler.visit_ArrayView/original