(A, i)
return z.reshape(-1, 1), colindx[0, :]
Return row i in BSR matrix A.

    Only nonzero entries are returned

    Parameters
    ----------
    A : bsr_matrix
        Input matrix
    i : int
        Row number

    Returns
    -------
    z : array
        Actual nonzero values for row i colindx Array of column indices for the
        nonzeros of row i

    Examples
    --------
    >>> from numpy import array
    >>> from scipy.sparse import bsr_matrix
    >>> from pyamg.util.bsr_utils import bsr_getrow
    >>> indptr  = array([0,2,3,6])
    >>> indices = array([0,2,2,0,1,2])
    >>> data    = array([1,2,3,4,5,6]).repeat(4).reshape(6,2,2)
    >>> B = bsr_matrix( (data,indices,indptr), shape=(6,6) )
    >>> Brow = bsr_getrow(B,2)
    >>> print(Brow[1])
    [4 5]
Return row i in BSR matrix A.
Return row i in BSR matrix A .
def bsr_getrow(A, i):
    """Return row i in BSR matrix A.

    Only nonzero entries are returned

    Parameters
    ----------
    A : bsr_matrix
        Input matrix
    i : int
        Row number

    Returns
    -------
    z : array
        Actual nonzero values for row i colindx Array of column indices for the
        nonzeros of row i

    Examples
    --------
    >>> from numpy import array
    >>> from scipy.sparse import bsr_matrix
    >>> from pyamg.util.bsr_utils import bsr_getrow
    >>> indptr  = array([0,2,3,6])
    >>> indices = array([0,2,2,0,1,2])
    >>> data    = array([1,2,3,4,5,6]).repeat(4).reshape(6,2,2)
    >>> B = bsr_matrix( (data,indices,indptr), shape=(6,6) )
    >>> Brow = bsr_getrow(B,2)
    >>> print(Brow[1])
    [4 5]

    """
    blocksize = A.blocksize[0]
    BlockIndx = int(i/blocksize)
    rowstart = A.indptr[BlockIndx]
    rowend = A.indptr[BlockIndx+1]
    localRowIndx = i % blocksize

    # Get z
    indys = A.data[rowstart:rowend, localRowIndx, :].nonzero()
    z = A.data[rowstart:rowend, localRowIndx, :][indys[0], indys[1]]

    colindx = np.zeros((1, z.__len__()), dtype=np.int32)
    counter = 0

    for j in range(rowstart, rowend):
        coloffset = blocksize*A.indices[j]
        indys = A.data[j, localRowIndx, :].nonzero()[0]
        increment = indys.shape[0]
        colindx[0, counter:(counter+increment)] = coloffset + indys
        counter += increment

    return z.reshape(-1, 1), colindx[0, :]
def bsr_getrow ( A , i ) : blocksize = A . blocksize [ 0 ] BlockIndx = int ( i / blocksize ) rowstart = A . indptr [ BlockIndx ] rowend = A . indptr [ BlockIndx + 1 ] localRowIndx = i % blocksize # Get z indys = A . data [ rowstart : rowend , localRowIndx , : ] . nonzero ( ) z = A . data [ rowstart : rowend , localRowIndx , : ] [ indys [ 0 ] , indys [ 1 ] ] colindx = np . zeros ( ( 1 , z . __len__ ( ) ) , dtype = np . int32 ) counter = 0 for j in range ( rowstart , rowend ) : coloffset = blocksize * A . indices [ j ] indys = A . data [ j , localRowIndx , : ] . nonzero ( ) [ 0 ] increment = indys . shape [ 0 ] colindx [ 0 , counter : ( counter + increment ) ] = coloffset + indys counter += increment return z . reshape ( - 1 , 1 ) , colindx [ 0 , : ]