Example #1
0
def test_concatenate_errors(sc):

    x = arange(2*3*4).reshape((2, 3, 4))
    b = array(x, sc, axis=0)

    with pytest.raises(ValueError):
        concatenate(b)

    with pytest.raises(NotImplementedError):
        concatenate((b, b, b))
def test_concatenate():

    from numpy import concatenate as npconcatenate

    x = arange(2 * 3 * 4).reshape((2, 3, 4))
    b = concatenate((x, x))
    assert allclose(npconcatenate((x, x)), b.toarray())
Example #3
0
def test_concatenate(sc):

    from numpy import concatenate as npconcatenate
    x = arange(2*3*4).reshape((2, 3, 4))

    b = array(x, sc, axis=0)
    bb = concatenate((b, b), axis=0)
    assert allclose(npconcatenate((x, x), axis=0), bb.toarray())

    bb = concatenate((b, b), axis=1)
    assert allclose(npconcatenate((x, x), axis=1), bb.toarray())

    bb = concatenate((b, b), axis=2)
    assert allclose(npconcatenate((x, x), axis=2), bb.toarray())

    b = array(x, sc, axis=(0, 1))
    bb = concatenate((b, b), axis=0)
    assert allclose(npconcatenate((x, x), axis=0), bb.toarray())

    b = array(x, sc, axis=(0, 1))
    bb = concatenate((b, b), axis=1)
    assert allclose(npconcatenate((x, x), axis=1), bb.toarray())

    b = array(x, sc, axis=(0, 1))
    bb = concatenate((b, b), axis=2)
    assert allclose(npconcatenate((x, x), axis=2), bb.toarray())
Example #4
0
    def concatenate(self, arry, axis=0):
        """
        Join this array with another array.

        Paramters
        ---------
        arry : ndarray or BoltArrayLocal
            Another array to concatenate with

        axis : int, optional, default=0
            The axis along which arrays will be joined.

        Returns
        -------
        BoltArrayLocal
        """
        if isinstance(arry, ndarray):
            from bolt import concatenate
            return concatenate((self, arry), axis)
        else:
            raise ValueError("other must be local array, got %s" % type(arry))
Example #5
0
    def concatenate(self, arry, axis=0):
        """
        Join this array with another array.

        Paramters
        ---------
        arry : ndarray or BoltArrayLocal
            Another array to concatenate with

        axis : int, optional, default=0
            The axis along which arrays will be joined.

        Returns
        -------
        BoltArrayLocal
        """
        if isinstance(arry, ndarray):
            from bolt import concatenate
            return concatenate((self, arry), axis)
        else:
            raise ValueError("other must be local array, got %s" % type(arry))
def test_concatenate_errors():

    x = arange(2 * 3 * 4).reshape((2, 3, 4))

    with pytest.raises(ValueError):
        concatenate(x)
Example #7
0
def test_concatenate_errors():

    x = arange(2 * 3 * 4).reshape((2, 3, 4))

    with pytest.raises(ValueError):
        concatenate(x)
Example #8
0
def test_concatenate():

    from numpy import concatenate as npconcatenate
    x = arange(2 * 3 * 4).reshape((2, 3, 4))
    b = concatenate((x, x))
    assert allclose(npconcatenate((x, x)), b.toarray())
Example #9
0
 def concatenate(self, arry, axis=0):
     if isinstance(arry, ndarray):
         from bolt import concatenate
         return concatenate((self, arry), axis)
     else:
         raise ValueError("other must be local array, got %s" % type(arry))
Example #10
0
 def concatenate(self, arry, axis=0):
     if isinstance(arry, ndarray):
         from bolt import concatenate
         return concatenate((self, arry), axis)
     else:
         raise ValueError("other must be local array, got %s" % type(arry))