Quanlse/Simulator/__init__.py
def diagMat(self) -> ndarray:
        """
        Return the diagonal matrix of the Hamiltonian.

        :return: a diagonal matrix
        """

        levelList = []
        identityList = []

        # Define the list of different identity matrix for each subsystem
        if isinstance(self.sysLevel, int):
            levelList = [self.sysLevel for _ in range(self.subSysNum)]
            identityList = [identity(self.sysLevel) for _ in range(self.subSysNum)]

        elif isinstance(self.sysLevel, list):
            levelList = self.sysLevel
            identityList = [identity(self.sysLevel[i]) for i in range(self.subSysNum)]

        # Initialize the diagonal term
        diagTerm = zeros([self.dim, self.dim], dtype=complex)

        # Add drift terms to the diagonal term
        for index, wq in self.qubitFreq.items():
            numMat = copy.deepcopy(identityList)
            numMat[index] = numMat[index] @ number(levelList[index]).matrix
            diagTerm += wq * tensor(numMat)

        return diagTerm

        Return the diagonal matrix of the Hamiltonian.

        :return: a diagonal matrix
        
Return the diagonal matrix of the Hamiltonian.
Return the diagonal matrix of the Hamiltonian .
def diagMat(self) -> ndarray:
        levelList = []
        identityList = []
        if isinstance(self.sysLevel, int):
            levelList = [self.sysLevel for _ in range(self.subSysNum)]
            identityList = [identity(self.sysLevel) for _ in range(self.subSysNum)]
        elif isinstance(self.sysLevel, list):
            levelList = self.sysLevel
            identityList = [identity(self.sysLevel[i]) for i in range(self.subSysNum)]
        diagTerm = zeros([self.dim, self.dim], dtype=complex)
        for index, wq in self.qubitFreq.items():
            numMat = copy.deepcopy(identityList)
            numMat[index] = numMat[index] @ number(levelList[index]).matrix
            diagTerm += wq * tensor(numMat)
        return diagTerm
def diagMat ( self ) -> ndarray : levelList = [ ] identityList = [ ] if isinstance ( self . sysLevel , int ) : levelList = [ self . sysLevel for _ in range ( self . subSysNum ) ] identityList = [ identity ( self . sysLevel ) for _ in range ( self . subSysNum ) ] elif isinstance ( self . sysLevel , list ) : levelList = self . sysLevel identityList = [ identity ( self . sysLevel [ i ] ) for i in range ( self . subSysNum ) ] diagTerm = zeros ( [ self . dim , self . dim ] , dtype = complex ) for index , wq in self . qubitFreq . items ( ) : numMat = copy . deepcopy ( identityList ) numMat [ index ] = numMat [ index ] @ number ( levelList [ index ] ) . matrix diagTerm += wq * tensor ( numMat ) return diagTerm
Return the diagonal matrix of the Hamiltonian.
Return the diagonal matrix of the Hamiltonian .
"""
        Return the diagonal matrix of the Hamiltonian.

        :return: a diagonal matrix
        """ # Define the list of different identity matrix for each subsystem # Initialize the diagonal term # Add drift terms to the diagonal term
a diagonal matrix
a diagonal matrix
self