code: public static DMatrixSparseCSC extractRows(DMatrixSparseCSC A , int row0 , int row1 , DMatrixSparseCSC out ) {
  
          if( out == null )
              out = new DMatrixSparseCSC(1,1,1);
  
          out.reshape(row1-row0,A.numCols,A.nz_length);
  //        out.col_idx[0] = 0;
  //        out.nz_length = 0;
  
          for (int col = 0; col < A.numCols; col++) {
              int idx0 = A.col_idx[col];
              int idx1 = A.col_idx[col+1];
  
              for (int i = idx0; i < idx1; i++) {
                  int row = A.nz_rows[i];
                  if( row >= row0 && row < row1 ) {
                      out.nz_values[out.nz_length] = A.nz_values[i];
                      out.nz_rows[out.nz_length++] = row-row0;
                  }
              }
              out.col_idx[col+1] = out.nz_length;
          }
  
          return out;
      }
docs: Creates a submatrix by extracting the specified rows from A. rows = {row0 %le; i %le; row1}.
  @param A (Input) matrix
  @param row0 First row. Inclusive
  @param row1 Last row+1.
  @param out (Output, Option) Storage for output matrix
  @return The submatrix