code: public double trace() {
          double result = 0.0;
  
          for (int i = 0; i < rows; i++) {
              result += get(i, i);
          }
  
          return result;
      }
docs: Calculates the trace of this matrix.
  
  <p>
  See <a href="http://mathworld.wolfram.com/MatrixTrace.html">
  http://mathworld.wolfram.com/MatrixTrace.html</a> for more details.
  </p>
  
  @return the trace of this matrix