public static void write(File file, Iterator<DenseMatrixRow> rows) throws IOException { write(file, rows, new ValueConf()); } public static void write(File file, Iterator<DenseMatrixRow> rows, ValueConf vconf) throws IOException {
public static void write(File file, Iterator<SparseMatrixRow> rows) throws IOException { write(file, rows, new ValueConf()); } public static void write(File file, Iterator<SparseMatrixRow> rows, ValueConf vconf) throws IOException {
public static void write(File file, Iterator<DenseMatrixRow> rows) throws IOException { write(file, rows, new ValueConf()); } public static void write(File file, Iterator<DenseMatrixRow> rows, ValueConf vconf) throws IOException {
public static void write(File file, Iterator<SparseMatrixRow> rows) throws IOException { write(file, rows, new ValueConf()); } public static void write(File file, Iterator<SparseMatrixRow> rows, ValueConf vconf) throws IOException {
private void readHeaders() throws IOException { long size = Math.min(channel.size(), DEFAULT_HEADER_SIZE); MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, size); if (buffer.getInt(0) != FILE_HEADER) { throw new IOException("invalid file header: " + buffer.getInt(0)); } this.vconf = new ValueConf(buffer.getFloat(4), buffer.getFloat(8)); this.numRows = buffer.getInt(12); int headerSize = 16 + 12*numRows; if (headerSize > DEFAULT_HEADER_SIZE) { info("maxPageSize not large enough for entire header. Resizing to " + headerSize); buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, headerSize); } debug("preparing buffer for " + numRows + " rows"); buffer.position(16); buffer.limit(buffer.position() + 4 * numRows); rowIds = buffer.slice().asIntBuffer(); if (rowIds.capacity() != numRows) { throw new IllegalStateException(); } buffer.position(16 + 4 * numRows); buffer.limit(buffer.position() + 8 * numRows); rowOffsets = buffer.slice().asLongBuffer(); if (rowOffsets.capacity() != numRows) { throw new IllegalStateException(); } }
private void readHeaders() throws IOException { long size = Math.min(channel.size(), DEFAULT_HEADER_SIZE); MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, size); if (buffer.getInt(0) != FILE_HEADER) { throw new IOException("invalid file header: " + buffer.getInt(0)); } this.vconf = new ValueConf(buffer.getFloat(4), buffer.getFloat(8)); this.numRows = buffer.getInt(12); int headerSize = 16 + 12*numRows; if (headerSize > DEFAULT_HEADER_SIZE) { info("maxPageSize not large enough for entire header. Resizing to " + headerSize); buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, headerSize); } debug("preparing buffer for " + numRows + " rows"); buffer.position(16); buffer.limit(buffer.position() + 4 * numRows); rowIds = buffer.slice().asIntBuffer(); if (rowIds.capacity() != numRows) { throw new IllegalStateException(); } buffer.position(16 + 4 * numRows); buffer.limit(buffer.position() + 8 * numRows); rowOffsets = buffer.slice().asLongBuffer(); if (rowOffsets.capacity() != numRows) { throw new IllegalStateException(); } }
FileUtils.deleteQuietly(getArticleMatrixPath()); ValueConf vconf = new ValueConf(); BufferedWriter phraseIdWriter = WpIOUtils.openWriter(getPhraseIdPath()); DenseMatrixWriter phraseWriter = new DenseMatrixWriter(getPhraseMatrixPath(), vconf);
throw new IOException("invalid file header: " + buffer.getInt(0)); this.vconf = new ValueConf(buffer.getFloat(4), buffer.getFloat(8)); this.numRows = buffer.getInt(12); int numCols = buffer.getInt(16);
throw new IOException("invalid file header: " + buffer.getInt(0)); this.vconf = new ValueConf(buffer.getFloat(4), buffer.getFloat(8)); this.numRows = buffer.getInt(12); int numCols = buffer.getInt(16);
ValueConf vconf = new ValueConf(); // unused because there are no values. SparseMatrixWriter writer = new SparseMatrixWriter(getMatrixFile(), vconf);
vconf = new ValueConf(min, max);
vconf = new ValueConf(min, max);
ValueConf vconf = new ValueConf((float)similarity.getMinValue(), (float)similarity.getMaxValue()); final SparseMatrixWriter writer = new SparseMatrixWriter(getFeatureMatrixPath(), vconf);
final AtomicInteger idCounter = new AtomicInteger(); final AtomicLong cellCounter = new AtomicLong(); ValueConf vconf = new ValueConf(config.minScore, config.maxScore);