'check whether the matrix format is valid
*Parameters*:
full_check:
True  - rigorous check, O(N) operations : default
False - basic check, O(1) operations'

def check_format(self, full_check=True):

    (M, N) = self.shape
    (R, C) = self.blocksize
    if (self.indptr.dtype.kind != 'i'):
        warn(('indptr    array    has    non-integer    dtype    (%s)' % self.indptr.dtype.name))
    if (self.indices.dtype.kind != 'i'):
        warn(('indices    array    has    non-integer    dtype    (%s)' % self.indices.dtype.name))
    idx_dtype = get_index_dtype((self.indices, self.indptr))
    self.indptr = np.asarray(self.indptr, dtype=idx_dtype)
    self.indices = np.asarray(self.indices, dtype=idx_dtype)
    self.data = to_native(self.data)
    if ((self.indices.ndim != 1) or (self.indptr.ndim != 1)):
        raise ValueError('indices,    and    indptr    should    be    1-D')
    if (self.data.ndim != 3):
        raise ValueError('data    should    be    3-D')
    if (len(self.indptr) != ((M // R) + 1)):
        raise ValueError(('index    pointer    size    (%d)    should    be    (%d)' % (len(self.indptr), ((M // R) + 1))))
    if (self.indptr[0] != 0):
        raise ValueError('index    pointer    should    start    with    0')
    if (len(self.indices) != len(self.data)):
        raise ValueError('indices    and    data    should    have    the    same    size')
    if (self.indptr[(-1)] > len(self.indices)):
        raise ValueError('Last    value    of    index    pointer    should    be    less    than    the    size    of    index    and    data    arrays')
    self.prune()
    if full_check:
        if (self.nnz > 0):
            if (self.indices.max() >= (N // C)):
                raise ValueError(('column    index    values    must    be    <    %d    (now    max    %d)' % ((N // C), self.indices.max())))
            if (self.indices.min() < 0):
                raise ValueError('column    index    values    must    be    >=    0')
            if (np.diff(self.indptr).min() < 0):
                raise ValueError('index    pointer    values    must    form    a    non-decreasing    sequence')
