Quanlse/Simulator/PulseSimQCQ.py
def staticZZ(obj: Union[PulseModel, QHamiltonian]) -> float:
    r"""
    Compute the static ZZ strength of the given QCQ model

    :param obj: input a PulseModel object or QHamiltonian object

    :return: a float
    """

    if isinstance(obj, PulseModel):
        ham = obj.createQHamiltonian(frameMode='lab')
    elif isinstance(obj, QHamiltonian):
        ham = obj
    else:
        raise Error.ArgumentError("Pleases input a PulseModel object or a QHamiltonian object.")

    if ham.sysLevel == [3, 4, 4]:

        ham.buildCache()
        matQCQ = copy.deepcopy(ham.driftCache)

        # Create Qubit-Qubit subspace basis vectors
        vec00 = tensor(basis(3, 0), basis(4, 0), basis(4, 0))
        vec01 = tensor(basis(3, 0), basis(4, 0), basis(4, 1))
        vec10 = tensor(basis(3, 0), basis(4, 1), basis(4, 0))
        vec11 = tensor(basis(3, 0), basis(4, 1), basis(4, 1))

        # Get the eigen system of QCQ Hamiltonian
        originEigenVals, originEigenVecs = eigenSystem(matQCQ)

        # vector indexes of QQ eigenvectors
        idx00 = findIndex(originEigenVecs, [vec00])[0]
        idx10 = findIndex(originEigenVecs, [vec10])[0]
        idx01 = findIndex(originEigenVecs, [vec01])[0]
        idx11 = findIndex(originEigenVecs, [vec11])[0]

        staticZZCrossTalk = originEigenVals[idx00] - originEigenVals[idx10] - \
                            originEigenVals[idx01] + originEigenVals[idx11]

    else:
        raise Error.ArgumentError("Coupler (index: 0) level should be 3 and Qubit (index: 1, 2) level should be 4.")

    return staticZZCrossTalk
r"""
    Compute the static ZZ strength of the given QCQ model

    :param obj: input a PulseModel object or QHamiltonian object

    :return: a float
    
r"""
Compute the static ZZ strength of the given QCQ model
r " " " Compute the static ZZ strength of the given QCQ model
def staticZZ(obj: Union[PulseModel, QHamiltonian]) -> float:
    if isinstance(obj, PulseModel):
        ham = obj.createQHamiltonian(frameMode='lab')
    elif isinstance(obj, QHamiltonian):
        ham = obj
    else:
        raise Error.ArgumentError("Pleases input a PulseModel object or a QHamiltonian object.")
    if ham.sysLevel == [3, 4, 4]:
        ham.buildCache()
        matQCQ = copy.deepcopy(ham.driftCache)
        vec00 = tensor(basis(3, 0), basis(4, 0), basis(4, 0))
        vec01 = tensor(basis(3, 0), basis(4, 0), basis(4, 1))
        vec10 = tensor(basis(3, 0), basis(4, 1), basis(4, 0))
        vec11 = tensor(basis(3, 0), basis(4, 1), basis(4, 1))
        originEigenVals, originEigenVecs = eigenSystem(matQCQ)
        idx00 = findIndex(originEigenVecs, [vec00])[0]
        idx10 = findIndex(originEigenVecs, [vec10])[0]
        idx01 = findIndex(originEigenVecs, [vec01])[0]
        idx11 = findIndex(originEigenVecs, [vec11])[0]
        staticZZCrossTalk = originEigenVals[idx00] - originEigenVals[idx10] - \
                            originEigenVals[idx01] + originEigenVals[idx11]
    else:
        raise Error.ArgumentError("Coupler (index: 0) level should be 3 and Qubit (index: 1, 2) level should be 4.")
    return staticZZCrossTalk
def staticZZ ( obj : Union [ PulseModel , QHamiltonian ] ) -> float : if isinstance ( obj , PulseModel ) : ham = obj . createQHamiltonian ( frameMode = 'lab' ) elif isinstance ( obj , QHamiltonian ) : ham = obj else : raise Error . ArgumentError ( "Pleases input a PulseModel object or a QHamiltonian object." ) if ham . sysLevel == [ 3 , 4 , 4 ] : ham . buildCache ( ) matQCQ = copy . deepcopy ( ham . driftCache ) vec00 = tensor ( basis ( 3 , 0 ) , basis ( 4 , 0 ) , basis ( 4 , 0 ) ) vec01 = tensor ( basis ( 3 , 0 ) , basis ( 4 , 0 ) , basis ( 4 , 1 ) ) vec10 = tensor ( basis ( 3 , 0 ) , basis ( 4 , 1 ) , basis ( 4 , 0 ) ) vec11 = tensor ( basis ( 3 , 0 ) , basis ( 4 , 1 ) , basis ( 4 , 1 ) ) originEigenVals , originEigenVecs = eigenSystem ( matQCQ ) idx00 = findIndex ( originEigenVecs , [ vec00 ] ) [ 0 ] idx10 = findIndex ( originEigenVecs , [ vec10 ] ) [ 0 ] idx01 = findIndex ( originEigenVecs , [ vec01 ] ) [ 0 ] idx11 = findIndex ( originEigenVecs , [ vec11 ] ) [ 0 ] staticZZCrossTalk = originEigenVals [ idx00 ] - originEigenVals [ idx10 ] - originEigenVals [ idx01 ] + originEigenVals [ idx11 ] else : raise Error . ArgumentError ( "Coupler (index: 0) level should be 3 and Qubit (index: 1, 2) level should be 4." ) return staticZZCrossTalk
r"""
Compute the static ZZ strength of the given QCQ model
r " " " Compute the static ZZ strength of the given QCQ model
r"""
    Compute the static ZZ strength of the given QCQ model

    :param obj: input a PulseModel object or QHamiltonian object

    :return: a float
    """ # Create Qubit-Qubit subspace basis vectors # Get the eigen system of QCQ Hamiltonian # vector indexes of QQ eigenvectors
None
obj
Union[PulseModel, QHamiltonian]
input a PulseModel object or QHamiltonian object
input a PulseModel object or QHamiltonian object