def symrcm(A, sym=False):
    '\n    Returns the permutation array that orders a sparse CSR or CSC matrix or Qobj\n    in Reverse-Cuthill McKee ordering.  Since the input matrix must be symmetric,\n    this routine works on the matrix A+Trans(A) if the sym flag is set to False (Default).\n    \n    It is assumed by default (*sym=False*) that the input matrix is not symmetric.  This\n    is because it is faster to do A+Trans(A) than it is to check for symmetry for \n    a generic matrix.  If you are guaranteed that the matrix is symmetric in structure\n    (values of matrix element do not matter) then set *sym=True*\n    \n    Parameters\n    ----------\n    A : csr_matrix, qobj\n        Input sparse csr_matrix or Qobj.\n    \n    sym : bool {False, True}\n        Flag to set whether input matrix is symmetric.\n    \n    Returns\n    -------\n    perm : array\n        Array of permuted row and column indices.\n    \n    Notes\n    -----\n    This routine is used primarily for internal reordering of Lindblad super-operators\n    for use in iterative solver routines.\n     \n    References\n    ----------\n    E. Cuthill and J. McKee, "Reducing the Bandwidth of Sparse Symmetric Matrices",\n    ACM \'69 Proceedings of the 1969 24th national conference, (1969).\n        \n    '
    nrows = A.shape[0]
    if (A.__class__.__name__ == 'Qobj'):
        if (not sym):
            A = (A.data + A.data.transpose())
            return _rcm(A.indices, A.indptr, nrows)
        else:
            return _rcm(A.data.indices, A.data.indptr, nrows)
    else:
        if (not sym):
            A = (A + A.transpose())
        return _rcm(A.indices, A.indptr, nrows)
Returns the permutation array that orders a sparse CSR or CSC matrix or Qobj
in Reverse-Cuthill McKee ordering.  Since the input matrix must be symmetric,
this routine works on the matrix A+Trans(A) if the sym flag is set to False (Default).

It is assumed by default (*sym=False*) that the input matrix is not symmetric.  This
is because it is faster to do A+Trans(A) than it is to check for symmetry for 
a generic matrix.  If you are guaranteed that the matrix is symmetric in structure
(values of matrix element do not matter) then set *sym=True*

Parameters
----------
A : csr_matrix, qobj
    Input sparse csr_matrix or Qobj.

sym : bool {False, True}
    Flag to set whether input matrix is symmetric.

Returns
-------
perm : array
    Array of permuted row and column indices.

Notes
-----
This routine is used primarily for internal reordering of Lindblad super-operators
for use in iterative solver routines.
 
References
----------
E. Cuthill and J. McKee, "Reducing the Bandwidth of Sparse Symmetric Matrices",
ACM '69 Proceedings of the 1969 24th national conference, (1969).
def symrcm(A, sym=False):
    '\n    Returns the permutation array that orders a sparse CSR or CSC matrix or Qobj\n    in Reverse-Cuthill McKee ordering.  Since the input matrix must be symmetric,\n    this routine works on the matrix A+Trans(A) if the sym flag is set to False (Default).\n    \n    It is assumed by default (*sym=False*) that the input matrix is not symmetric.  This\n    is because it is faster to do A+Trans(A) than it is to check for symmetry for \n    a generic matrix.  If you are guaranteed that the matrix is symmetric in structure\n    (values of matrix element do not matter) then set *sym=True*\n    \n    Parameters\n    ----------\n    A : csr_matrix, qobj\n        Input sparse csr_matrix or Qobj.\n    \n    sym : bool {False, True}\n        Flag to set whether input matrix is symmetric.\n    \n    Returns\n    -------\n    perm : array\n        Array of permuted row and column indices.\n    \n    Notes\n    -----\n    This routine is used primarily for internal reordering of Lindblad super-operators\n    for use in iterative solver routines.\n     \n    References\n    ----------\n    E. Cuthill and J. McKee, "Reducing the Bandwidth of Sparse Symmetric Matrices",\n    ACM \'69 Proceedings of the 1969 24th national conference, (1969).\n        \n    '
    nrows = A.shape[0]
    if (A.__class__.__name__ == 'Qobj'):
        if (not sym):
            A = (A.data + A.data.transpose())
            return _rcm(A.indices, A.indptr, nrows)
        else:
            return _rcm(A.data.indices, A.data.indptr, nrows)
    else:
        if (not sym):
            A = (A + A.transpose())
        return _rcm(A.indices, A.indptr, nrows)