com.yahoo.memory.WritableMemory.getDouble()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中com.yahoo.memory.WritableMemory.getDouble()方法的一些代码示例,展示了WritableMemory.getDouble()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WritableMemory.getDouble()方法的具体详情如下:
包路径:com.yahoo.memory.WritableMemory
类名称:WritableMemory
方法名:getDouble

WritableMemory.getDouble介绍

暂无

代码示例

代码示例来源:origin: DataSketches/sketches-core

@Override
protected void updateValues(final int index, final double[] values) {
 long offset = valuesOffset_ + ((long) SIZE_OF_VALUE_BYTES * numValues_ * index);
 for (int i = 0; i < numValues_; i++) {
  mem_.putDouble(offset, mem_.getDouble(offset) + values[i]);
  offset += SIZE_OF_VALUE_BYTES;
 }
}

代码示例来源:origin: DataSketches/sketches-core

@Override
public double getMinValue() {
 return isEmpty() ? Double.NaN : mem_.getDouble(MIN_DOUBLE);
}

代码示例来源:origin: DataSketches/sketches-core

@Override
public double getMaxValue() {
 return isEmpty() ? Double.NaN : mem_.getDouble(MAX_DOUBLE);
}

代码示例来源:origin: DataSketches/sketches-core

@Override
public double getMinValue() {
 return isEmpty() ? Double.NaN : mem_.getDouble(MIN_DOUBLE);
}

代码示例来源:origin: DataSketches/sketches-core

@Override
public double getMaxValue() {
 return isEmpty() ? Double.NaN : mem_.getDouble(MAX_DOUBLE);
}

代码示例来源:origin: DataSketches/sketches-core

@Override
double get(final int index) {
 assert index >= 0 && index < numItems_;
 assert n_ == ds_.getN();
 final int idxOffset = offset_ + (index << 3);
 return ds_.getMemory().getDouble(idxOffset);
}

代码示例来源:origin: DataSketches/sketches-core

@Override
double set(final int index, final double value) {
 assert index >= 0 && index < numItems_;
 assert n_ == ds_.getN();
 assert !ds_.isCompact(); // can't write to a compact sketch
 final int idxOffset = offset_ + (index << 3);
 final WritableMemory mem = ds_.getMemory();
 final double oldVal = mem.getDouble(idxOffset);
 mem.putDouble(idxOffset, value);
 return oldVal;
}

代码示例来源:origin: DataSketches/sketches-core

@Test
public void checkSimplePropagateCarryDirect() {
 final int k = 16;
 final int n = k * 2;
 final int memBytes = DoublesSketch.getUpdatableStorageBytes(k, n);
 final WritableMemory mem = WritableMemory.wrap(new byte[memBytes]);
 final DoublesSketchBuilder bldr = DoublesSketch.builder();
 final UpdateDoublesSketch ds = bldr.setK(k).build(mem);
 for (int i = 1; i <= n; i++) { // 1 ... n
  ds.update(i);
 }
 double last = 0.0;
 for (int i = 0; i < k; i++) { //check the level 0
  final double d = mem.getDouble((4 + (2 * k) + i) << 3);
  assertTrue(d > 0);
  assertTrue(d > last);
  last = d;
 }
 //println(ds.toString(true, true));
}

代码示例来源:origin: DataSketches/sketches-core

@Test
public void checkHeapifyUnsortedCompactV2() {
 final int k = 64;
 final UpdateDoublesSketch qs = DoublesSketch.builder().setK(64).build();
 for (int i = 0; i < (3 * k); ++i) {
  qs.update(i);
 }
 assertEquals(qs.getBaseBufferCount(), k);
 final byte[] sketchBytes = qs.toByteArray(true);
 final WritableMemory mem = WritableMemory.wrap(sketchBytes);
 // modify to make v2, clear compact flag, and insert a -1 in the middle of the base buffer
 PreambleUtil.insertSerVer(mem, 2);
 PreambleUtil.insertFlags(mem, 0);
 final long tgtAddr = COMBINED_BUFFER + ((Double.BYTES * k) / 2);
 mem.putDouble(tgtAddr, -1.0);
 assert mem.getDouble(tgtAddr - Double.BYTES) > mem.getDouble(tgtAddr);
 // ensure the heapified base buffer is sorted
 final HeapCompactDoublesSketch qs2 = HeapCompactDoublesSketch.heapifyInstance(mem);
 checkBaseBufferIsSorted(qs2);
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
protected void updateValues(final int index, final double[] values) {
 long offset = valuesOffset_ + (SIZE_OF_VALUE_BYTES * numValues_ * index);
 for (int i = 0; i < numValues_; i++) {
  mem_.putDouble(offset, mem_.getDouble(offset) + values[i]);
  offset += SIZE_OF_VALUE_BYTES;
 }
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
public double getMaxValue() {
 return isEmpty() ? Double.NaN : mem_.getDouble(MAX_DOUBLE);
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
public double getMinValue() {
 return isEmpty() ? Double.NaN : mem_.getDouble(MIN_DOUBLE);
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
public double getMinValue() {
 return isEmpty() ? Double.NaN : mem_.getDouble(MIN_DOUBLE);
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
public double getMaxValue() {
 return isEmpty() ? Double.NaN : mem_.getDouble(MAX_DOUBLE);
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
double get(final int index) {
 assert index >= 0 && index < numItems_;
 assert n_ == ds_.getN();
 final int idxOffset = offset_ + (index << 3);
 return ds_.getMemory().getDouble(idxOffset);
}

代码示例来源:origin: com.yahoo.datasketches/sketches-core

@Override
double set(final int index, final double value) {
 assert index >= 0 && index < numItems_;
 assert n_ == ds_.getN();
 assert !ds_.isCompact(); // can't write to a compact sketch
 final int idxOffset = offset_ + (index << 3);
 final WritableMemory mem = ds_.getMemory();
 final double oldVal = mem.getDouble(idxOffset);
 mem.putDouble(idxOffset, value);
 return oldVal;
}

相关文章