Java Code Examples for java.io.DataInput#readDouble()
The following examples show how to use
java.io.DataInput#readDouble() .
These examples are extracted from open source projects.
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 Project: systemds File: MatrixBlock.java License: 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 2
Source Project: systemds File: SparseBlockCSR.java License: 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 Project: traffic-engine File: TripLineSerializer.java License: 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 Project: systemds File: ColGroupDDC2.java License: 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 5
Source Project: gemfirexd-oss File: DataSerializer.java License: 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 6
Source Project: gemfirexd-oss File: DeltaFastAssetAccount.java License: 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 7
Source Project: OSPREY3 File: QuadraticApproximator.java License: 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 8
Source Project: flink-perf File: KMeansDriver.java License: 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 9
Source Project: hadoop File: LoadSplit.java License: 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 10
Source Project: gemfirexd-oss File: DeltaFastAssetAccount.java License: 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 Project: gemfirexd-oss File: FastAssetAccount.java License: 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 12
Source Project: stratosphere File: DoubleValue.java License: Apache License 2.0 | 4 votes |
@Override public void read(DataInput in) throws IOException { this.value = in.readDouble(); }
Example 13
Source Project: deeplearning4j File: DoubleWritable.java License: Apache License 2.0 | 4 votes |
public void readFields(DataInput in) throws IOException { value = in.readDouble(); }
Example 14
Source Project: hadoop-gpu File: Key.java License: 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 15
Source Project: stratio-cassandra File: StatsMetadata.java License: 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 16
Source Project: systemds File: WeightedCell.java License: Apache License 2.0 | 4 votes |
@Override public void readFields(DataInput in) throws IOException { value=in.readDouble(); weight=in.readDouble(); }
Example 17
Source Project: systemds File: KahanObject.java License: Apache License 2.0 | 4 votes |
public void read(DataInput in) throws IOException { _sum=in.readDouble(); _correction=in.readDouble(); }
Example 18
Source Project: semafor-semantic-parser File: LDouble.java License: GNU General Public License v3.0 | 4 votes |
public void readFields(DataInput in) throws IOException { value=in.readDouble(); sign=in.readBoolean(); }
Example 19
Source Project: gemfirexd-oss File: MapLiteSerializer.java License: Apache License 2.0 | 4 votes |
public static Double readDouble(DataInput input) throws IOException { return input.readDouble(); }
Example 20
Source Project: tomcatsrc File: ConstantDouble.java License: 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(); }