Quanlse/Simulator/PulseSimQCQ.py
def rearrange(mat: ndarray) -> ndarray:
    """
    Rearrange the Q-Q Hamiltonian matrix by the excitation number

    :param mat: input Hamiltonian matrix

    :return: rearranged matrix
    """
    if mat.shape == (16, 16):
        matCache = copy.deepcopy(mat)

        matCache[:, [2, 4]] = matCache[:, [4, 2]]
        matCache[[2, 4], :] = matCache[[4, 2], :]

        matCache[:, [3, 5]] = matCache[:, [5, 3]]
        matCache[[3, 5], :] = matCache[[5, 3], :]

        matCache[:, [5, 8]] = matCache[:, [8, 5]]
        matCache[[5, 8], :] = matCache[[8, 5], :]

        matCache[:, [7, 12]] = matCache[:, [12, 7]]
        matCache[[7, 12], :] = matCache[[12, 7], :]

        matCache[:, [6, 8]] = matCache[:, [8, 6]]
        matCache[[6, 8], :] = matCache[[8, 6], :]

        matCache[:, [7, 9]] = matCache[:, [9, 7]]
        matCache[[7, 9], :] = matCache[[9, 7], :]

        matCache[:, [7, 8]] = matCache[:, [8, 7]]
        matCache[[7, 8], :] = matCache[[8, 7], :]

        matCache[:, [11, 13]] = matCache[:, [13, 11]]
        matCache[[11, 13], :] = matCache[[13, 11], :]

    else:
        raise Error.ArgumentError("The matrix dimension should be (16, 16)")

    return matCache

    Rearrange the Q-Q Hamiltonian matrix by the excitation number

    :param mat: input Hamiltonian matrix

    :return: rearranged matrix
    
Rearrange the Q-Q Hamiltonian matrix by the excitation number
Rearrange the Q - Q Hamiltonian matrix by the excitation number
def rearrange(mat: ndarray) -> ndarray:
    if mat.shape == (16, 16):
        matCache = copy.deepcopy(mat)
        matCache[:, [2, 4]] = matCache[:, [4, 2]]
        matCache[[2, 4], :] = matCache[[4, 2], :]
        matCache[:, [3, 5]] = matCache[:, [5, 3]]
        matCache[[3, 5], :] = matCache[[5, 3], :]
        matCache[:, [5, 8]] = matCache[:, [8, 5]]
        matCache[[5, 8], :] = matCache[[8, 5], :]
        matCache[:, [7, 12]] = matCache[:, [12, 7]]
        matCache[[7, 12], :] = matCache[[12, 7], :]
        matCache[:, [6, 8]] = matCache[:, [8, 6]]
        matCache[[6, 8], :] = matCache[[8, 6], :]
        matCache[:, [7, 9]] = matCache[:, [9, 7]]
        matCache[[7, 9], :] = matCache[[9, 7], :]
        matCache[:, [7, 8]] = matCache[:, [8, 7]]
        matCache[[7, 8], :] = matCache[[8, 7], :]
        matCache[:, [11, 13]] = matCache[:, [13, 11]]
        matCache[[11, 13], :] = matCache[[13, 11], :]
    else:
        raise Error.ArgumentError("The matrix dimension should be (16, 16)")
    return matCache
def rearrange ( mat : ndarray ) -> ndarray : if mat . shape == ( 16 , 16 ) : matCache = copy . deepcopy ( mat ) matCache [ : , [ 2 , 4 ] ] = matCache [ : , [ 4 , 2 ] ] matCache [ [ 2 , 4 ] , : ] = matCache [ [ 4 , 2 ] , : ] matCache [ : , [ 3 , 5 ] ] = matCache [ : , [ 5 , 3 ] ] matCache [ [ 3 , 5 ] , : ] = matCache [ [ 5 , 3 ] , : ] matCache [ : , [ 5 , 8 ] ] = matCache [ : , [ 8 , 5 ] ] matCache [ [ 5 , 8 ] , : ] = matCache [ [ 8 , 5 ] , : ] matCache [ : , [ 7 , 12 ] ] = matCache [ : , [ 12 , 7 ] ] matCache [ [ 7 , 12 ] , : ] = matCache [ [ 12 , 7 ] , : ] matCache [ : , [ 6 , 8 ] ] = matCache [ : , [ 8 , 6 ] ] matCache [ [ 6 , 8 ] , : ] = matCache [ [ 8 , 6 ] , : ] matCache [ : , [ 7 , 9 ] ] = matCache [ : , [ 9 , 7 ] ] matCache [ [ 7 , 9 ] , : ] = matCache [ [ 9 , 7 ] , : ] matCache [ : , [ 7 , 8 ] ] = matCache [ : , [ 8 , 7 ] ] matCache [ [ 7 , 8 ] , : ] = matCache [ [ 8 , 7 ] , : ] matCache [ : , [ 11 , 13 ] ] = matCache [ : , [ 13 , 11 ] ] matCache [ [ 11 , 13 ] , : ] = matCache [ [ 13 , 11 ] , : ] else : raise Error . ArgumentError ( "The matrix dimension should be (16, 16)" ) return matCache
Rearrange the Q-Q Hamiltonian matrix by the excitation number
Rearrange the Q - Q Hamiltonian matrix by the excitation number
"""
    Rearrange the Q-Q Hamiltonian matrix by the excitation number

    :param mat: input Hamiltonian matrix

    :return: rearranged matrix
    """
None
mat
ndarray
input Hamiltonian matrix
input Hamiltonian matrix