Quanlse/Simulator/__init__.py
def _setDecoherence(self, ham: QHamiltonian) -> None:
        r"""
        Define the collapse operators accounts for the decoherence noise
        for solving Lindblad master equation of the open system evolution.

        :math:`C_{\rm relaxation} = \frac{1}{\sqrt{T1}} a`
        :math:`C_{\rm dephasing} = \frac{1}{\sqrt{T2}} a^\dagger a`

        :param ham: The QHamiltonian object.
        :return: None
        """
        levelList = []

        # Compute the list of different level for each qubit
        if isinstance(self.sysLevel, list):
            levelList = self.sysLevel

        elif isinstance(self.sysLevel, int):
            levelList = [self.sysLevel for _ in range(self.subSysNum)]

        if self.T1 is None and self.T2 is None:
            pass

        # Initialize the dict type data of T1 and T2 for each qubit
        else:
            t1List = {}
            t2List = {}

            for index in range(self.subSysNum):
                t1List[index] = None
                t2List[index] = None

            if self.T1 is not None:
                for index, t1 in self.T1.items():
                    t1List[index] = t1

            if self.T2 is not None:
                for index, t2 in self.T2.items():
                    t2List[index] = t2

            # Initialize the dict type data for the collapse operators
            cList = {}

            # Calculate the collapse operators for each qubit based on t1List and t2List

            for index in t1List.keys():
                t1 = t1List[index]
                t2 = t2List[index]

                if t1 is None and t2 is None:
                    continue

                elif t2 is not None:
                    cList[index] = []
                    if t1 is not None:
                        rate1 = 1 / t1
                        mat = a(levelList[index])
                        cList[index].append(sqrt(rate1) * mat)

                        rate2 = 0.5 * ((1 / t2) - (1 / (2 * t1)))
                        mat = 2 * adagger(levelList[index]) @ a(levelList[index])
                        cList[index].append(sqrt(rate2) * mat)
                    else:
                        rate2 = 0.5 * (1 / t2)
                        mat = 2 * adagger(levelList[index]) @ a(levelList[index])
                        cList[index].append(sqrt(rate2) * mat)

                elif t1 is not None:
                    cList[index] = []
                    rate1 = 1 / t1
                    mat = a(levelList[index])
                    cList[index].append(sqrt(rate1) * mat)

            ham.setCollapse(cList)
r"""
        Define the collapse operators accounts for the decoherence noise
        for solving Lindblad master equation of the open system evolution.

        :math:`C_{\rm relaxation} = \frac{1}{\sqrt{T1}} a`
        :math:`C_{\rm dephasing} = \frac{1}{\sqrt{T2}} a^\dagger a`

        :param ham: The QHamiltonian object.
        :return: None
        
r"""
Define the collapse operators accounts for the decoherence noise
for solving Lindblad master equation of the open system evolution.
r " " " Define the collapse operators accounts for the decoherence noise for solving Lindblad master equation of the open system evolution .
def _setDecoherence(self, ham: QHamiltonian) -> None:
        levelList = []
        if isinstance(self.sysLevel, list):
            levelList = self.sysLevel
        elif isinstance(self.sysLevel, int):
            levelList = [self.sysLevel for _ in range(self.subSysNum)]
        if self.T1 is None and self.T2 is None:
            pass
        else:
            t1List = {}
            t2List = {}
            for index in range(self.subSysNum):
                t1List[index] = None
                t2List[index] = None
            if self.T1 is not None:
                for index, t1 in self.T1.items():
                    t1List[index] = t1
            if self.T2 is not None:
                for index, t2 in self.T2.items():
                    t2List[index] = t2
            cList = {}
            for index in t1List.keys():
                t1 = t1List[index]
                t2 = t2List[index]
                if t1 is None and t2 is None:
                    continue
                elif t2 is not None:
                    cList[index] = []
                    if t1 is not None:
                        rate1 = 1 / t1
                        mat = a(levelList[index])
                        cList[index].append(sqrt(rate1) * mat)
                        rate2 = 0.5 * ((1 / t2) - (1 / (2 * t1)))
                        mat = 2 * adagger(levelList[index]) @ a(levelList[index])
                        cList[index].append(sqrt(rate2) * mat)
                    else:
                        rate2 = 0.5 * (1 / t2)
                        mat = 2 * adagger(levelList[index]) @ a(levelList[index])
                        cList[index].append(sqrt(rate2) * mat)
                elif t1 is not None:
                    cList[index] = []
                    rate1 = 1 / t1
                    mat = a(levelList[index])
                    cList[index].append(sqrt(rate1) * mat)
            ham.setCollapse(cList)
def _setDecoherence ( self , ham : QHamiltonian ) -> None : levelList = [ ] if isinstance ( self . sysLevel , list ) : levelList = self . sysLevel elif isinstance ( self . sysLevel , int ) : levelList = [ self . sysLevel for _ in range ( self . subSysNum ) ] if self . T1 is None and self . T2 is None : pass else : t1List = { } t2List = { } for index in range ( self . subSysNum ) : t1List [ index ] = None t2List [ index ] = None if self . T1 is not None : for index , t1 in self . T1 . items ( ) : t1List [ index ] = t1 if self . T2 is not None : for index , t2 in self . T2 . items ( ) : t2List [ index ] = t2 cList = { } for index in t1List . keys ( ) : t1 = t1List [ index ] t2 = t2List [ index ] if t1 is None and t2 is None : continue elif t2 is not None : cList [ index ] = [ ] if t1 is not None : rate1 = 1 / t1 mat = a ( levelList [ index ] ) cList [ index ] . append ( sqrt ( rate1 ) * mat ) rate2 = 0.5 * ( ( 1 / t2 ) - ( 1 / ( 2 * t1 ) ) ) mat = 2 * adagger ( levelList [ index ] ) @ a ( levelList [ index ] ) cList [ index ] . append ( sqrt ( rate2 ) * mat ) else : rate2 = 0.5 * ( 1 / t2 ) mat = 2 * adagger ( levelList [ index ] ) @ a ( levelList [ index ] ) cList [ index ] . append ( sqrt ( rate2 ) * mat ) elif t1 is not None : cList [ index ] = [ ] rate1 = 1 / t1 mat = a ( levelList [ index ] ) cList [ index ] . append ( sqrt ( rate1 ) * mat ) ham . setCollapse ( cList )
r"""
Define the collapse operators accounts for the decoherence noise
for solving Lindblad master equation of the open system evolution.
r " " " Define the collapse operators accounts for the decoherence noise for solving Lindblad master equation of the open system evolution .
r"""
        Define the collapse operators accounts for the decoherence noise
        for solving Lindblad master equation of the open system evolution.

        :math:`C_{\rm relaxation} = \frac{1}{\sqrt{T1}} a`
        :math:`C_{\rm dephasing} = \frac{1}{\sqrt{T2}} a^\dagger a`

        :param ham: The QHamiltonian object.
        :return: None
        """ # Compute the list of different level for each qubit # Initialize the dict type data of T1 and T2 for each qubit # Initialize the dict type data for the collapse operators # Calculate the collapse operators for each qubit based on t1List and t2List
None
self
ham
QHamiltonian
The QHamiltonian object.
The QHamiltonian object .
math
None
math
None