docs: @GuardedBy("lock")
      protected void _compact() {
          // This is the range we need to copy into the new matrix (including from and to)
          int from=computeRow(low), to=computeRow(hr);
          int range=to - from +1;  // e.g. from=3, to=5, new_size has to be [3 .. 5] (=3)
  
          int new_size=(int)Math.max( (double)range * resize_factor, (double) range +1 );
          new_size=Math.max(new_size, num_rows); // don't fall below the initial size defined
          if(new_size < matrix.length) {
              T[][] new_matrix=(T[][])new Object[new_size][];
              System.arraycopy(matrix, from, new_matrix, 0, range);
              matrix=new_matrix;
              offset+=from * elements_per_row;
              num_compactions++;
          }
      }