code: public static void extractDiag(DMatrixRMaj src, DMatrixRMaj dst )
      {
          int N = Math.min(src.numRows, src.numCols);
  
          if( !MatrixFeatures_DDRM.isVector(dst) || dst.numCols*dst.numCols != N ) {
              dst.reshape(N,1);
          }
  
          for( int i = 0; i < N; i++ ) {
              dst.set( i , src.unsafe_get(i,i) );
          }
      }
docs: <p>
  Extracts the diagonal elements 'src' write it to the 'dst' vector.  'dst'
  can either be a row or column vector.
  <p>
  
  @param src Matrix whose diagonal elements are being extracted. Not modified.
  @param dst A vector the results will be written into. Modified.