code: public static DMatrixRMaj identity(int numRows , int numCols )
      {
          DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols);
  
          int small = numRows < numCols ? numRows : numCols;
  
          for( int i = 0; i < small; i++ ) {
              ret.set(i,i,1.0);
          }
  
          return ret;
      }
docs: Creates a rectangular matrix which is zero except along the diagonals.
  
  @param numRows Number of rows in the matrix.
  @param numCols NUmber of columns in the matrix.
  @return A matrix with diagonal elements equal to one.