qlazy/DensOp.py
def expect(self, matrix=None):
        """
        get the expectation value of matrix under this density operator.

        Parameters
        ----------
        matrix : list of list of complex
            matrix expression of hermitian operator.

        Returns
        -------
        value : float
            expectation value.

        Notes
        -----
        'matrix' must be hermitian, and its dimension is equal to
        the dimension of density operator.

        """
        densop = self.clone()
        densop_apply_matrix(densop, matrix=matrix, dire='left')
        value = densop.trace()
        return value

        get the expectation value of matrix under this density operator.

        Parameters
        ----------
        matrix : list of list of complex
            matrix expression of hermitian operator.

        Returns
        -------
        value : float
            expectation value.

        Notes
        -----
        'matrix' must be hermitian, and its dimension is equal to
        the dimension of density operator.

        
get the expectation value of matrix under this density operator.
Parameters

matrix : list of list of complex
matrix expression of hermitian operator.

Returns

value : float
expectation value.

Notes

'matrix' must be hermitian, and its dimension is equal to
the dimension of density operator.
get the expectation value of matrix under this density operator . Parameters matrix : list of list of complex matrix expression of hermitian operator . Returns value : float expectation value . Notes ' matrix ' must be hermitian and its dimension is equal to the dimension of density operator .
def expect(self, matrix=None):
        densop = self.clone()
        densop_apply_matrix(densop, matrix=matrix, dire='left')
        value = densop.trace()
        return value
def expect ( self , matrix = None ) : densop = self . clone ( ) densop_apply_matrix ( densop , matrix = matrix , dire = 'left' ) value = densop . trace ( ) return value
get the expectation value of matrix under this density operator.
get the expectation value of matrix under this density operator .
"""
        get the expectation value of matrix under this density operator.

        Parameters
        ----------
        matrix : list of list of complex
            matrix expression of hermitian operator.

        Returns
        -------
        value : float
            expectation value.

        Notes
        -----
        'matrix' must be hermitian, and its dimension is equal to
        the dimension of density operator.

        """
self
matrix