def empty(shape, dtype=np.float): """Return a new :ref:`pyDive.cloned_ndarray` utilizing all engines without initializing elements. :param ints shape: shape of the array :param numpy-dtype dtype: datatype of a single data value """ result = cloned_ndarray.cloned_ndarray(shape, dtype, target_ranks='all') return result
def hollow(shape, dtype=np.float): """Return a new :ref:`pyDive.cloned_ndarray` utilizing all engines without allocating a local *numpy-array*. :param ints shape: shape of the array :param numpy-dtype dtype: datatype of a single data value """ result = cloned_ndarray.cloned_ndarray(shape, dtype, target_ranks='all', no_allocation=True) return result
def empty_engines_like(shape, dtype, a): """Return a new :obj:`pyDive.cloned_ndarray` utilizing the same engines *a* does without initializing elements. :param ints shape: shape of the array :param numpy-dtype dtype: datatype of a single data value :param a: :ref:`pyDive.ndarray` """ return cloned_ndarray.cloned_ndarray(shape, dtype, a.target_ranks)
def hollow_engines_like(shape, dtype, a): """Return a new :obj:`pyDive.cloned_ndarray` utilizing the same engines *a* does without allocating a local *numpy-array*. :param ints shape: shape of the array :param numpy-dtype dtype: datatype of a single data value :param a: :ref:`pyDive.ndarray` """ return cloned_ndarray.cloned_ndarray(shape, dtype, a.target_ranks, True)
def ones(shape, dtype=np.float): """Return a new :ref:`pyDive.cloned_ndarray` utilizing all engines filled with ones. :param ints shape: shape of the array :param numpy-dtype dtype: datatype of a single data value """ result = cloned_ndarray.cloned_ndarray(shape, dtype, target_ranks='all', no_allocation=True) view = com.getView() view.push({'myshape' : shape, 'dtype' : dtype}, targets=result.target_ranks) view.execute('%s = np.ones(myshape, dtype)' % repr(result), targets=result.target_ranks) return result
def zeros_engines_like(shape, dtype, a): """Return a new :ref:`pyDive.cloned_ndarray` utilizing the same engines *a* does filled with zeros. :param ints shape: shape of the array :param numpy-dtype dtype: datatype of a single data value :param a: :ref:`pyDive.ndarray` """ result = cloned_ndarray.cloned_ndarray(shape, dtype, a.target_ranks, True) view = com.getView() view.push({'myshape' : shape, 'dtype' : dtype}, targets=result.target_ranks) view.execute('%s = np.zeros(myshape, dtype)' % repr(result), targets=result.target_ranks) return result