(self, calc_transformation=True)
return type(self)(P), Jcells
r"""Return a list of Jordan cells of current matrix.
        This list shape Jordan matrix J.

        If calc_transformation is specified as False, then transformation P such that

              `J = P^{-1} \cdot M \cdot P`

        will not be calculated.

        Notes
        =====

        Calculation of transformation P is not implemented yet.

        Examples
        ========

        >>> from sympy import Matrix
        >>> m = Matrix(4, 4, [
        ...  6,  5, -2, -3,
        ... -3, -1,  3,  3,
        ...  2,  1, -2, -3,
        ... -1,  1,  5,  5])

        >>> P, Jcells = m.jordan_cells()
        >>> Jcells[0]
        Matrix([
        [2, 1],
        [0, 2]])
        >>> Jcells[1]
        Matrix([
        [2, 1],
        [0, 2]])

        See Also
        ========

        jordan_form
r"""Return a list of Jordan cells of current matrix.
        This list shape Jordan matrix J.
r Return a list of Jordan cells of current matrix . This list shape Jordan matrix J .
def jordan_cells(self, calc_transformation=True):
        r"""Return a list of Jordan cells of current matrix.
        This list shape Jordan matrix J.

        If calc_transformation is specified as False, then transformation P such that

              `J = P^{-1} \cdot M \cdot P`

        will not be calculated.

        Notes
        =====

        Calculation of transformation P is not implemented yet.

        Examples
        ========

        >>> from sympy import Matrix
        >>> m = Matrix(4, 4, [
        ...  6,  5, -2, -3,
        ... -3, -1,  3,  3,
        ...  2,  1, -2, -3,
        ... -1,  1,  5,  5])

        >>> P, Jcells = m.jordan_cells()
        >>> Jcells[0]
        Matrix([
        [2, 1],
        [0, 2]])
        >>> Jcells[1]
        Matrix([
        [2, 1],
        [0, 2]])

        See Also
        ========

        jordan_form
        """
        n = self.rows
        Jcells = []
        Pcols_new = []
        jordan_block_structures = self._jordan_block_structure()
        from sympy.matrices import MutableMatrix

        # Order according to default_sort_key, this makes sure the order is the same as in .diagonalize():
        for eigenval in (sorted(list(jordan_block_structures.keys()), key=default_sort_key)):
            l_jordan_chains = jordan_block_structures[eigenval]
            for s in reversed(sorted((l_jordan_chains).keys())):  # Start with the biggest block
                s_chains = l_jordan_chains[s]
                block = self.jordan_cell(eigenval, s)
                number_of_s_chains=len(s_chains)
                for i in range(0, number_of_s_chains):
                    Jcells.append(type(self)(block))
                    chain_vectors = s_chains[i]
                    lc = len(chain_vectors)
                    assert lc == s
                    for j in range(0, lc):
                        generalized_eigen_vector = chain_vectors[j]
                        Pcols_new.append(generalized_eigen_vector)
        P = MutableMatrix.zeros(n)
        for j in range(0, n):
            P[:, j] = Pcols_new[j]

        return type(self)(P), Jcells
def jordan_cells ( self , calc_transformation = True ) : n = self . rows Jcells = [ ] Pcols_new = [ ] jordan_block_structures = self . _jordan_block_structure ( ) from sympy . matrices import MutableMatrix # Order according to default_sort_key, this makes sure the order is the same as in .diagonalize(): for eigenval in ( sorted ( list ( jordan_block_structures . keys ( ) ) , key = default_sort_key ) ) : l_jordan_chains = jordan_block_structures [ eigenval ] for s in reversed ( sorted ( ( l_jordan_chains ) . keys ( ) ) ) : # Start with the biggest block s_chains = l_jordan_chains [ s ] block = self . jordan_cell ( eigenval , s ) number_of_s_chains = len ( s_chains ) for i in range ( 0 , number_of_s_chains ) : Jcells . append ( type ( self ) ( block ) ) chain_vectors = s_chains [ i ] lc = len ( chain_vectors ) assert lc == s for j in range ( 0 , lc ) : generalized_eigen_vector = chain_vectors [ j ] Pcols_new . append ( generalized_eigen_vector ) P = MutableMatrix . zeros ( n ) for j in range ( 0 , n ) : P [ : , j ] = Pcols_new [ j ] return type ( self ) ( P ) , Jcells