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

Method __init__

test/arrayimpl.py:170–188  ·  view source on GitHub ↗
(self, arg, typecode, shape=None)

Source from the content-addressed store, hash-verified

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):

Callers 5

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 3

mkshapeFunction · 0.85
productFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected