java.io.DataInput#readDouble ( )源码实例Demo

下面列出了java.io.DataInput#readDouble ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: systemds   文件: MatrixBlock.java
private void readUltraSparseBlock(DataInput in)
	throws IOException 
{
	//allocate ultra-sparse block in CSR to avoid unnecessary size overhead 
	//and to allow efficient reset without repeated sparse row allocation
	
	//adjust size and ensure reuse block is in CSR format
	allocateAndResetSparseBlock(false, SparseBlock.Type.CSR);
	
	if( clen > 1 ) { //ULTRA-SPARSE BLOCK
		//block: read ijv-triples (ordered by row and column) via custom 
		//init to avoid repeated updates of row pointers per append
		SparseBlockCSR sblockCSR = (SparseBlockCSR) sparseBlock;
		sblockCSR.initUltraSparse((int)nonZeros, in);
	}
	else { //ULTRA-SPARSE COL
		//col: read iv-pairs (should never happen since always dense)
		for(long i=0; i<nonZeros; i++) {
			int r = in.readInt();
			double val = in.readDouble();
			sparseBlock.allocate(r, 1, 1);
			sparseBlock.append(r, 0, val);
		}
	}
}
 
源代码2 项目: systemds   文件: SparseBlockCSR.java
/**
 * Initializes the CSR sparse block from an ordered input
 * stream of sparse rows (rownnz, jv-pairs*). 
 * 
 * @param rlen number of rows
 * @param nnz number of non-zeros to read
 * @param in data input stream of sparse rows, ordered by i
 * @throws IOException if deserialization error occurs
 */
public void initSparse(int rlen, int nnz, DataInput in) 
	throws IOException
{
	//allocate space if necessary
	if( _values.length < nnz )
		resize(newCapacity(nnz));
	
	//read sparse rows, append and update pointers
	_ptr[0] = 0;
	for( int r=0, pos=0; r<rlen; r++ ) {
		int lnnz = in.readInt();
		for( int j=0; j<lnnz; j++, pos++ ) {
			_indexes[pos] = in.readInt();
			_values[pos] = in.readDouble();
		}
		_ptr[r+1] = pos;
	}
	
	//update meta data
	_size = nnz;
}
 
源代码3 项目: traffic-engine   文件: TripLineSerializer.java
@Override
public TripLine deserialize(DataInput in, int available) throws IOException {
    long id = in.readLong();
    int geomSize = in.readInt();

    Coordinate coords[] = new Coordinate[geomSize];

    for(int i = 0; i < geomSize; i++) {
        coords[i] = new Coordinate(in.readDouble(), in.readDouble());
    }

    long segmentId = in.readLong();
    int tripLineIndex = in.readInt();
    double dist = in.readDouble();

    TripLine item = new TripLine(id, coords, segmentId, tripLineIndex, dist);

    return item;
}
 
源代码4 项目: systemds   文件: ColGroupDDC2.java
@Override
public void readFields(DataInput in) throws IOException {
	_numRows = in.readInt();
	int numCols = in.readInt();
	int numVals = in.readInt();

	// read col indices
	_colIndexes = new int[numCols];
	for(int i = 0; i < numCols; i++)
		_colIndexes[i] = in.readInt();

	// read distinct values
	double[] values = new double[numVals * numCols];
	for(int i = 0; i < numVals * numCols; i++)
		values[i] = in.readDouble();
	_dict = new Dictionary(values);
	
	// read data
	_data = new char[_numRows];
	for(int i = 0; i < _numRows; i++)
		_data[i] = in.readChar();
}
 
源代码5 项目: gemfirexd-oss   文件: DataSerializer.java
/**
 * Reads a primitive <code>double</code> from a
 * <code>DataInput</code>.
 *
 * @throws IOException
 *         A problem occurs while reading from <code>in</code>
 * @see DataInput#readDouble
 * @since 5.1
 */
public static double readPrimitiveDouble(DataInput in) throws IOException {
  InternalDataSerializer.checkIn(in);

  double value = in.readDouble();
  if (DEBUG) {
    InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Read Double " + value);
  }
  return value;
}
 
源代码6 项目: gemfirexd-oss   文件: DeltaFastAssetAccount.java
public void fromDelta(DataInput in)
throws IOException {
  if (getBeforeUpdate) {
    this.netWorth = in.readDouble();
  } else {
    this.netWorth += in.readDouble();
  }
  if (encodeTimestamp) {
    this.timestamp = in.readLong();
  }
  if (fineEnabled) {
    Log.getLogWriter().info("INVOKED: fromDelta on key " + this.acctId);
  }
}
 
源代码7 项目: OSPREY3   文件: QuadraticApproximator.java
@Override
public void readFrom(DataInput in)
throws IOException {
	for (int i=0; i<coefficients.size(); i++) {
		coefficients.set(i, in.readDouble());
	}
	maxe = in.readDouble();
}
 
源代码8 项目: flink-perf   文件: KMeansDriver.java
@Override
public void readFields(DataInput dataInput) throws IOException {
	this.n = dataInput.readInt();
	this.coord = new double[n];
	for (int i = 0; i < n; i++)
		this.coord[i] = dataInput.readDouble();
}
 
源代码9 项目: hadoop   文件: LoadSplit.java
@Override
public void readFields(DataInput in) throws IOException {
  super.readFields(in);
  id = WritableUtils.readVInt(in);
  maps = WritableUtils.readVInt(in);
  inputRecords = WritableUtils.readVLong(in);
  outputBytes = WritableUtils.readVLong(in);
  outputRecords = WritableUtils.readVLong(in);
  maxMemory = WritableUtils.readVLong(in);
  reduces = WritableUtils.readVInt(in);
  if (reduceBytes.length < reduces) {
    reduceBytes = new double[reduces];
    reduceRecords = new double[reduces];
  }
  for (int i = 0; i < reduces; ++i) {
    reduceBytes[i] = in.readDouble();
    reduceRecords[i] = in.readDouble();
  }
  nSpec = WritableUtils.readVInt(in);
  if (reduceOutputBytes.length < nSpec) {
    reduceOutputBytes = new long[nSpec];
    reduceOutputRecords = new long[nSpec];
  }
  for (int i = 0; i < nSpec; ++i) {
    reduceOutputBytes[i] = WritableUtils.readVLong(in);
    reduceOutputRecords[i] = WritableUtils.readVLong(in);
  }
  mapMetrics = new ResourceUsageMetrics();
  mapMetrics.readFields(in);
  int numReduceMetrics = WritableUtils.readVInt(in);
  reduceMetrics = new ResourceUsageMetrics[numReduceMetrics];
  for (int i = 0; i < numReduceMetrics; ++i) {
    reduceMetrics[i] = new ResourceUsageMetrics();
    reduceMetrics[i].readFields(in);
  }
}
 
源代码10 项目: gemfirexd-oss   文件: DeltaFastAssetAccount.java
public void fromDelta(DataInput in)
throws IOException {
  if (getBeforeUpdate) {
    this.netWorth = in.readDouble();
  } else {
    this.netWorth += in.readDouble();
  }
  if (encodeTimestamp) {
    this.timestamp = in.readLong();
  }
  if (fineEnabled) {
    Log.getLogWriter().info("INVOKED: fromDelta on key " + this.acctId);
  }
}
 
源代码11 项目: gemfirexd-oss   文件: FastAssetAccount.java
public void fromData(DataInput in)
throws IOException, ClassNotFoundException {
  this.acctId = in.readInt();
  this.customerName = DataSerializer.readString(in);
  this.netWorth = in.readDouble();
  this.assets = DataSerializer.readHashMap(in);
  this.timestamp = in.readLong();
  if (fineEnabled) {
    Log.getLogWriter().fine("INVOKED: fromData on key " + this.acctId);
  }
}
 
源代码12 项目: stratosphere   文件: DoubleValue.java
@Override
public void read(DataInput in) throws IOException {
	this.value = in.readDouble();
}
 
源代码13 项目: deeplearning4j   文件: DoubleWritable.java
public void readFields(DataInput in) throws IOException {
    value = in.readDouble();
}
 
源代码14 项目: hadoop-gpu   文件: Key.java
public void readFields(DataInput in) throws IOException {
  this.bytes = new byte[in.readInt()];
  in.readFully(this.bytes);
  weight = in.readDouble();
}
 
源代码15 项目: stratio-cassandra   文件: StatsMetadata.java
public StatsMetadata deserialize(Descriptor.Version version, DataInput in) throws IOException
{
    EstimatedHistogram rowSizes = EstimatedHistogram.serializer.deserialize(in);
    EstimatedHistogram columnCounts = EstimatedHistogram.serializer.deserialize(in);
    ReplayPosition replayPosition = ReplayPosition.serializer.deserialize(in);
    long minTimestamp = in.readLong();
    long maxTimestamp = in.readLong();
    int maxLocalDeletionTime = in.readInt();
    double compressionRatio = in.readDouble();
    StreamingHistogram tombstoneHistogram = StreamingHistogram.serializer.deserialize(in);
    int sstableLevel = in.readInt();
    long repairedAt = 0;
    if (version.hasRepairedAt)
        repairedAt = in.readLong();

    int colCount = in.readInt();
    List<ByteBuffer> minColumnNames = new ArrayList<>(colCount);
    for (int i = 0; i < colCount; i++)
        minColumnNames.add(ByteBufferUtil.readWithShortLength(in));

    colCount = in.readInt();
    List<ByteBuffer> maxColumnNames = new ArrayList<>(colCount);
    for (int i = 0; i < colCount; i++)
        maxColumnNames.add(ByteBufferUtil.readWithShortLength(in));

    boolean hasLegacyCounterShards = true;
    if (version.tracksLegacyCounterShards)
        hasLegacyCounterShards = in.readBoolean();

    return new StatsMetadata(rowSizes,
                             columnCounts,
                             replayPosition,
                             minTimestamp,
                             maxTimestamp,
                             maxLocalDeletionTime,
                             compressionRatio,
                             tombstoneHistogram,
                             sstableLevel,
                             minColumnNames,
                             maxColumnNames,
                             hasLegacyCounterShards,
                             repairedAt);
}
 
源代码16 项目: systemds   文件: WeightedCell.java
@Override
public void readFields(DataInput in) throws IOException {
	value=in.readDouble();
	weight=in.readDouble();
}
 
源代码17 项目: systemds   文件: KahanObject.java
public void read(DataInput in) throws IOException
{
	_sum=in.readDouble();
	_correction=in.readDouble();
}
 
源代码18 项目: semafor-semantic-parser   文件: LDouble.java
public void readFields(DataInput in) throws IOException
{
	value=in.readDouble();
	sign=in.readBoolean();
}
 
源代码19 项目: gemfirexd-oss   文件: MapLiteSerializer.java
public static Double readDouble(DataInput input) throws IOException
{
	return input.readDouble();
}
 
源代码20 项目: tomcatsrc   文件: ConstantDouble.java
/**
 * Initialize instance from file data.
 *
 * @param file Input stream
 * @throws IOException
 */
ConstantDouble(final DataInput file) throws IOException {
    super(Const.CONSTANT_Double);
    this.bytes = file.readDouble();
}