MCPcopy Create free account
hub / github.com/mpi4py/mpi4py / ArrayArray

Class ArrayArray

test/arrayimpl.py:167–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166 @add_backend
167 class ArrayArray(BaseArray):
168 backend = "array"
169
170 def __init__(self, arg, typecode, shape=None):
171 if isinstance(arg, (int, float)):
172 if shape is None:
173 shape = ()
174 else:
175 try:
176 shape = mkshape(shape)
177 except TypeError:
178 shape = (int(shape),)
179 size = product(shape)
180 arg = [arg] * size
181 else:
182 size = len(arg)
183 if shape is None:
184 shape = (size,)
185 else:
186 shape = mkshape(shape)
187 assert size == product(shape)
188 self.array = array.array(typecode, arg)
189
190 @property
191 def address(self):
192 return self.array.buffer_info()[0]
193
194 @property
195 def typecode(self):
196 return self.array.typecode
197
198 @property
199 def itemsize(self):
200 return self.array.itemsize
201
202 @property
203 def flat(self):
204 return self.array
205
206 @property
207 def size(self):
208 return self.array.buffer_info()[1]
209
210
211if numpy is not None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…