Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
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