def block_structure(self):
        """For square matrices this gives the block (-diagonal) structure of
        the matrix as a tuple of integers that sum up to the full dimension.

        :rtype: tuple
        """
        n, m = self.shape
        if n != m:
            raise AttributeError("block_structure only defined for square "
                                 "matrices")
        for k in range(1, n):
            if ((self.matrix[:k, k:] == 0).all() and
                    (self.matrix[k:, :k] == 0).all()):
                return (k,) + self[k:, k:].block_structure
        return n,
def block_structure ( self ) : n , m = self . shape if n != m : raise AttributeError ( "block_structure only defined for square " "matrices" ) for k in range ( 1 , n ) : if ( ( self . matrix [ : k , k : ] == 0 ) . all ( ) and ( self . matrix [ k : , : k ] == 0 ) . all ( ) ) : return ( k , ) + self [ k : , k : ] . block_structure return n ,
For square matrices this gives the block (-diagonal) structure of
        the matrix as a tuple of integers that sum up to the full dimension.

        :rtype: tuple