code: public double trace()
      {
          double t = 0;
          for (int i = 0; i < Math.min(m, n); i++)
          {
              t += A[i][i];
          }
          return t;
      }
docs: Matrix trace.
  
  @return sum of the diagonal elements.