code: public static DMatrixRMaj diagR(int numRows , int numCols , double ...diagEl )
      {
          DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols);
  
          int o = Math.min(numRows,numCols);
  
          for( int i = 0; i < o; i++ ) {
              ret.set(i, i, diagEl[i]);
          }
  
          return ret;
      }
docs: <p>
  Creates a new rectangular matrix whose diagonal elements are specified by diagEl and all
  the other elements are zero.<br>
  <br>
  a<sub>ij</sub> = 0         if i &le; j<br>
  a<sub>ij</sub> = diag[i]   if i = j<br>
  </p>
  
  @see #diag
  
  @param numRows Number of rows in the matrix.
  @param numCols Number of columns in the matrix.
  @param diagEl Contains the values of the diagonal elements of the resulting matrix.
  @return A new matrix.