code: private Chunk chunkD() {
      HashMap<Long,Byte> hs = new HashMap<>(CUDChunk.MAX_UNIQUES);
      Byte dummy = 0;
      final byte [] bs = MemoryManager.malloc1(_len *8,true);
      int j = 0;
      boolean fitsInUnique = true;
      for(int i = 0; i < _len; ++i){
        double d = 0;
        if(_id == null || _id.length == 0 || (j < _id.length && _id[j] == i)) {
          d = getDouble(j);
          ++j;
        }
        if (fitsInUnique) {
          if (hs.size() < CUDChunk.MAX_UNIQUES) //still got space
            hs.put(Double.doubleToLongBits(d),dummy); //store doubles as longs to avoid NaN comparison issues during extraction
          else fitsInUnique = (hs.size() == CUDChunk.MAX_UNIQUES) && // full, but might not need more space because of repeats
                              hs.containsKey(Double.doubleToLongBits(d));
        }
        UnsafeUtils.set8d(bs, 8*i, d);
      }
      assert j == _sparseLen :"j = " + j + ", _len = " + _sparseLen;
      if (fitsInUnique && CUDChunk.computeByteSize(hs.size(), len()) < 0.8 * bs.length)
        return new CUDChunk(bs, hs, len());
      else
        return new C8DChunk(bs);
    }
docs: Compute a compressed double buffer