(self)
return trace
Calculate the trace of a square matrix.

        Examples
        ========

        >>> from sympy.matrices import eye
        >>> eye(3).trace()
        3
Calculate the trace of a square matrix.
Calculate the trace of a square matrix .
def _eval_trace(self):
        """Calculate the trace of a square matrix.

        Examples
        ========

        >>> from sympy.matrices import eye
        >>> eye(3).trace()
        3

        """
        trace = S.Zero
        for i in range(self.cols):
            trace += self._smat.get((i, i), 0)
        return trace
def _eval_trace ( self ) : trace = S . Zero for i in range ( self . cols ) : trace += self . _smat . get ( ( i , i ) , 0 ) return trace