Java Code Examples for java.io.DataInput#readDouble()
The following examples show how to use
java.io.DataInput#readDouble() .
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: ColGroupDDC2.java From systemds with Apache License 2.0 | 6 votes |
@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(); }
Example 2
Source File: SparseBlockCSR.java From systemds with Apache License 2.0 | 6 votes |
/** * 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; }
Example 3
Source File: TripLineSerializer.java From traffic-engine with GNU General Public License v3.0 | 6 votes |
@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; }
Example 4
Source File: MatrixBlock.java From systemds with Apache License 2.0 | 6 votes |
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); } } }
Example 5
Source File: KMeansDriver.java From flink-perf with Apache License 2.0 | 5 votes |
@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(); }
Example 6
Source File: FastAssetAccount.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
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); } }
Example 7
Source File: DeltaFastAssetAccount.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
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); } }
Example 8
Source File: LoadSplit.java From hadoop with Apache License 2.0 | 5 votes |
@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); } }
Example 9
Source File: QuadraticApproximator.java From OSPREY3 with GNU General Public License v2.0 | 5 votes |
@Override public void readFrom(DataInput in) throws IOException { for (int i=0; i<coefficients.size(); i++) { coefficients.set(i, in.readDouble()); } maxe = in.readDouble(); }
Example 10
Source File: DeltaFastAssetAccount.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
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); } }
Example 11
Source File: DataSerializer.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * 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; }
Example 12
Source File: StatsMetadata.java From stratio-cassandra with Apache License 2.0 | 4 votes |
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); }
Example 13
Source File: WeightedCell.java From systemds with Apache License 2.0 | 4 votes |
@Override public void readFields(DataInput in) throws IOException { value=in.readDouble(); weight=in.readDouble(); }
Example 14
Source File: KahanObject.java From systemds with Apache License 2.0 | 4 votes |
public void read(DataInput in) throws IOException { _sum=in.readDouble(); _correction=in.readDouble(); }
Example 15
Source File: LDouble.java From semafor-semantic-parser with GNU General Public License v3.0 | 4 votes |
public void readFields(DataInput in) throws IOException { value=in.readDouble(); sign=in.readBoolean(); }
Example 16
Source File: MapLiteSerializer.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
public static Double readDouble(DataInput input) throws IOException { return input.readDouble(); }
Example 17
Source File: Key.java From hadoop-gpu with Apache License 2.0 | 4 votes |
public void readFields(DataInput in) throws IOException { this.bytes = new byte[in.readInt()]; in.readFully(this.bytes); weight = in.readDouble(); }
Example 18
Source File: DoubleWritable.java From deeplearning4j with Apache License 2.0 | 4 votes |
public void readFields(DataInput in) throws IOException { value = in.readDouble(); }
Example 19
Source File: DoubleValue.java From stratosphere with Apache License 2.0 | 4 votes |
@Override public void read(DataInput in) throws IOException { this.value = in.readDouble(); }
Example 20
Source File: ConstantDouble.java From tomcatsrc with Apache License 2.0 | 2 votes |
/** * 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(); }