def full_get_assoc_degree(ary, degree):
    """
    Function will fill the degree array with the number of nonzero values in
    each row, such that degree[i] contains the number of nonzero values of
    the i-th row of the ary matrix.
    Inputs:
        ary     : input matrix of shape r,c
        degree  : array of shape r
    Outputs:
        nnz     : total number of nonzero values
    """
    rows, cols = ary.shape
    nnz = 0
    for row in range(rows):
        row_deg = 0
        for col in range(cols):
            if ary[row,col] != 0:
                row_deg += 1
        degree[row] = row_deg
        nnz += row_deg
    return nnz