Java Code Examples for com.esotericsoftware.kryo.io.Output#writeDouble()

The following examples show how to use com.esotericsoftware.kryo.io.Output#writeDouble() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DoubleOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
public void write(Kryo kryo, Output output, ArrayMetaData<double[]> object) {
    try {
        double[] arrData = arrayMetaData.getArrData();
        arrayMetaData.send(output);
        int arrSegNum = arrayMetaData.getSegNum();
        for (int i = 0; i < arrSegNum; i++) {
            int from = arrayMetaData.getFrom(i);
            int to = arrayMetaData.getTo(i);
            for (int j = from; j < to; j++) {
                output.writeDouble(arrData[j]);
            }
        }
    } catch (IOException e) {
        LOG.error("double array write exception", e);
        System.exit(1);
    }
}
 
Example 2
Source File: DoubleOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
public void write(Kryo kryo, Output output, MapMetaData<Double> object) {
    try {
        List<Map<String, Double>> mapDataList = mapMetaData.getMapDataList();
        mapMetaData.send(output);
        int mapSegNum = mapMetaData.getSegNum();
        for (int i = 0; i < mapSegNum; i++) {
            Map<String, Double> mapData = mapDataList.get(i);
            for (Map.Entry<String, Double> entry : mapData.entrySet()) {
                output.writeString(entry.getKey());
                output.writeDouble(entry.getValue());
            }
            if (mapMetaData.getCollective() == Collective.GATHER ||
                    mapMetaData.getCollective() == Collective.SCATTER ||
                    mapMetaData.getCollective() == Collective.REDUCE_SCATTER) {
                mapData.clear();
            }
        }

    } catch (IOException e) {
        LOG.error("double array write exception", e);
        System.exit(1);
    }
}
 
Example 3
Source File: OnlineStatisticsProvider.java    From metron with Apache License 2.0 6 votes vote down vote up
@Override
public void write(Kryo kryo, Output output) {
  //storing tdigest
  ByteBuffer outBuffer = ByteBuffer.allocate(digest.byteSize());
  digest.asBytes(outBuffer);
  byte[] tdigestSerialized = outBuffer.array();
  output.writeInt(tdigestSerialized.length);
  output.writeBytes(tdigestSerialized);
  output.writeLong(n);
  output.writeDouble(sum);
  output.writeDouble(sumOfSquares);
  output.writeDouble(sumOfLogs);
  output.writeDouble(getMin());
  output.writeDouble(getMax());
  output.writeDouble(M1);
  output.writeDouble(M2);
  output.writeDouble(M3);
  output.writeDouble(M4);
}
 
Example 4
Source File: PercentileCounterSerializer.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, PercentileCounter counter) {
    int length = counter.getRegisters().byteSize();
    ByteBuffer buffer = ByteBuffer.allocate(length);
    counter.getRegisters().asSmallBytes(buffer);
    output.writeDouble(counter.getCompression());
    output.writeDouble(counter.getQuantileRatio());
    output.writeInt(buffer.position());
    output.write(buffer.array(), 0, buffer.position());
}
 
Example 5
Source File: PSKmerBloomFilter.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void serialize(final Kryo kryo, final Output output) {
    output.writeInt(kmerSize);
    output.writeLong(kmerMask.getLong());
    kryo.writeObject(output, kmerSet);
    output.writeDouble(falsePositiveProbability);
    output.close();
}
 
Example 6
Source File: PercentileCounterSerializer.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, PercentileCounter counter) {
    int length = counter.getRegisters().byteSize();
    ByteBuffer buffer = ByteBuffer.allocate(length);
    counter.getRegisters().asSmallBytes(buffer);
    output.writeDouble(counter.getCompression());
    output.writeDouble(counter.getQuantileRatio());
    output.writeInt(buffer.position());
    output.write(buffer.array(), 0, buffer.position());
}
 
Example 7
Source File: PercentileCounterSerializer.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, PercentileCounter counter) {
    int length = counter.getRegisters().byteSize();
    ByteBuffer buffer = ByteBuffer.allocate(length);
    counter.getRegisters().asSmallBytes(buffer);
    output.writeDouble(counter.getCompression());
    output.writeDouble(counter.getQuantileRatio());
    output.writeInt(buffer.position());
    output.write(buffer.array(), 0, buffer.position());
}
 
Example 8
Source File: ComputeContentEvent.java    From samoa with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, ComputeContentEvent object) {
	output.writeLong(object.splitId, true);
	output.writeLong(object.learningNodeId, true);
	
	output.writeInt(object.preSplitDist.length, true);
	for(int i = 0; i < object.preSplitDist.length; i++){
		output.writeDouble(object.preSplitDist[i], PRECISION, true);
	}
}
 
Example 9
Source File: ComputeContentEvent.java    From incubator-samoa with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, ComputeContentEvent object) {
  output.writeLong(object.splitId, true);
  output.writeLong(object.learningNodeId, true);

  output.writeInt(object.preSplitDist.length, true);
  for (int i = 0; i < object.preSplitDist.length; i++) {
    output.writeDouble(object.preSplitDist[i]);
  }
}
 
Example 10
Source File: ComputeContentEvent.java    From samoa with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, ComputeContentEvent object) {
	output.writeLong(object.splitId, true);
	output.writeLong(object.learningNodeId, true);
	
	output.writeInt(object.preSplitDist.length, true);
	for(int i = 0; i < object.preSplitDist.length; i++){
		output.writeDouble(object.preSplitDist[i]);
	}
}
 
Example 11
Source File: KryoReadingSerializer.java    From kafka-serializer-example with MIT License 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, SensorReading sensorReading) {
    output.writeString(sensorReading.getSensor().getId());
    output.writeString(sensorReading.getSensor().getType().toString());
    output.writeLong(sensorReading.getTime(), true);
    output.writeDouble(sensorReading.getValue());
}
 
Example 12
Source File: AttributeContentEvent.java    From samoa with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, AttributeContentEvent event) {		
	output.writeLong(event.learningNodeId, true);
	output.writeInt(event.obsIndex, true);
	output.writeDouble(event.attrVal, PRECISION, true);
	output.writeInt(event.classVal, true);
	output.writeDouble(event.weight, PRECISION, true);
	output.writeBoolean(event.isNominal);
}
 
Example 13
Source File: PercentileCounterSerializer.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, PercentileCounter counter) {
    int length = counter.getRegisters().byteSize();
    ByteBuffer buffer = ByteBuffer.allocate(length);
    counter.getRegisters().asSmallBytes(buffer);
    output.writeDouble(counter.getCompression());
    output.writeDouble(counter.getQuantileRatio());
    output.writeInt(buffer.position());
    output.write(buffer.array(), 0, buffer.position());
}
 
Example 14
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public void write (Kryo kryo, Output output, UniformDoubleDistribution object) {
	output.writeDouble(object.getLow());
	output.writeDouble(object.getHigh());
}
 
Example 15
Source File: PyFloatSerializer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, PyFloat object) {
	output.writeDouble(object.getValue());
}
 
Example 16
Source File: AtomicDoubleSerializer.java    From nd4j with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, AtomicDouble a) {
    output.writeDouble(a.get());
}
 
Example 17
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public void write (Kryo kryo, Output output, ConstantDoubleDistribution object) {
	output.writeDouble(object.getValue());
}
 
Example 18
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public void write (Kryo kryo, Output output, GaussianDoubleDistribution object) {
	output.writeDouble(object.getMean());
	output.writeDouble(object.getStandardDeviation());
}
 
Example 19
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public void write (Kryo kryo, Output output, TriangularDoubleDistribution object) {
	output.writeDouble(object.getLow());
	output.writeDouble(object.getHigh());
	output.writeDouble(object.getMode());
}
 
Example 20
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public void write (Kryo kryo, Output output, TriangularLongDistribution object) {
	output.writeLong(object.getLow());
	output.writeLong(object.getHigh());
	output.writeDouble(object.getMode());
}