@Test public void testTranspose() throws Exception { DistributedRowMatrix m = randomDistributedMatrix(10, 9, 5, 4, 1.0, false); m.setConf(getConfiguration()); DistributedRowMatrix mt = m.transpose(); mt.setConf(getConfiguration()); Path tmpPath = getTestTempDirPath(); m.setOutputTempPathString(tmpPath.toString()); Path tmpOutPath = new Path(tmpPath, "/tmpOutTranspose"); mt.setOutputTempPathString(tmpOutPath.toString()); HadoopUtil.delete(getConfiguration(), tmpOutPath); DistributedRowMatrix mtt = mt.transpose(); assertEquals(m, mtt, EPSILON); }
public DistributedRowMatrix transpose() throws IOException { Path outputPath = new Path(rowPath.getParent(), "transpose-" + (System.nanoTime() & 0xFF)); Configuration initialConf = getConf() == null ? new Configuration() : getConf(); Job transposeJob = TransposeJob.buildTransposeJob(initialConf, rowPath, outputPath, numRows); try { transposeJob.waitForCompletion(true); } catch (Exception e) { throw new IllegalStateException("transposition failed", e); } DistributedRowMatrix m = new DistributedRowMatrix(outputPath, outputTmpPath, numCols, numRows); m.setConf(this.conf); return m; }
DistributedRowMatrix implements VectorIterable, Configurable { public DistributedRowMatrix transpose() throws IOException { Path outputPath = new Path(rowPath.getParent(), "transpose-" + (System.nanoTime() & 0xFF)); Configuration initialConf = getConf() == null ? new Configuration() : getConf(); Job transposeJob = TransposeJob.buildTransposeJob(initialConf, rowPath, outputPath, numRows); try { transposeJob.waitForCompletion(true); } catch (Exception e) { throw new IllegalStateException("transposition failed", e); } DistributedRowMatrix m = new DistributedRowMatrix(outputPath, outputTmpPath, numCols, numRows); m.setConf(this.conf); return m; } }
DistributedRowMatrix implements VectorIterable, Configurable { public DistributedRowMatrix transpose() throws IOException { Path outputPath = new Path(rowPath.getParent(), "transpose-" + (System.nanoTime() & 0xFF)); Configuration initialConf = getConf() == null ? new Configuration() : getConf(); Job transposeJob = TransposeJob.buildTransposeJob(initialConf, rowPath, outputPath, numRows); try { transposeJob.waitForCompletion(true); } catch (Exception e) { throw new IllegalStateException("transposition failed", e); } DistributedRowMatrix m = new DistributedRowMatrix(outputPath, outputTmpPath, numCols, numRows); m.setConf(this.conf); return m; } DistributedRowMatrix(Path inputPath,
                              Path outputTmpPath,
                              int numRows,
                              int numCols);  DistributedRowMatrix(Path inputPath,
                              Path outputTmpPath,
                              int numRows,
                              int numCols,
                              boolean keepTempFiles); }
DistributedRowMatrix implements VectorIterable, Configurable { public DistributedRowMatrix transpose() throws IOException { Path outputPath = new Path(rowPath.getParent(), "transpose-" + (System.nanoTime() & 0xFF)); Configuration initialConf = getConf() == null ? new Configuration() : getConf(); Job transposeJob = TransposeJob.buildTransposeJob(initialConf, rowPath, outputPath, numRows); try { transposeJob.waitForCompletion(true); } catch (Exception e) { throw new IllegalStateException("transposition failed", e); } DistributedRowMatrix m = new DistributedRowMatrix(outputPath, outputTmpPath, numCols, numRows); m.setConf(this.conf); return m; } DistributedRowMatrix(Path inputPath,
                              Path outputTmpPath,
                              int numRows,
                              int numCols);  DistributedRowMatrix(Path inputPath,
                              Path outputTmpPath,
                              int numRows,
                              int numCols,
                              boolean keepTempFiles); @Override Configuration getConf(); @Override void setConf(Configuration conf); Path getRowPath(); Path getOutputTempPath(); void setOutputTempPathString(String outPathString); @Override Iterator<MatrixSlice> iterateAll(); @Override int numSlices(); @Override int numRows(); @Override int numCols(); DistributedRowMatrix times(DistributedRowMatrix other); DistributedRowMatrix times(DistributedRowMatrix other, Path outPath); Vector columnMeans(); Vector columnMeans(String vectorClass); DistributedRowMatrix transpose(); @Override Vector times(Vector v); @Override Vector timesSquared(Vector v); @Override Iterator<MatrixSlice> iterator(); }
DistributedRowMatrix implements VectorIterable, Configurable { public DistributedRowMatrix transpose() throws IOException { Path outputPath = new Path(rowPath.getParent(), "transpose-" + (System.nanoTime() & 0xFF)); Configuration initialConf = getConf() == null ? new Configuration() : getConf(); Job transposeJob = TransposeJob.buildTransposeJob(initialConf, rowPath, outputPath, numRows); try { transposeJob.waitForCompletion(true); } catch (Exception e) { throw new IllegalStateException("transposition failed", e); } DistributedRowMatrix m = new DistributedRowMatrix(outputPath, outputTmpPath, numCols, numRows); m.setConf(this.conf); return m; } DistributedRowMatrix(Path inputPath,
                              Path outputTmpPath,
                              int numRows,
                              int numCols);  DistributedRowMatrix(Path inputPath,
                              Path outputTmpPath,
                              int numRows,
                              int numCols,
                              boolean keepTempFiles); @Override Configuration getConf(); @Override void setConf(Configuration conf); Path getRowPath(); Path getOutputTempPath(); void setOutputTempPathString(String outPathString); @Override Iterator<MatrixSlice> iterateAll(); @Override int numSlices(); @Override int numRows(); @Override int numCols(); DistributedRowMatrix times(DistributedRowMatrix other); DistributedRowMatrix times(DistributedRowMatrix other, Path outPath); Vector columnMeans(); Vector columnMeans(String vectorClass); DistributedRowMatrix transpose(); @Override Vector times(Vector v); @Override Vector timesSquared(Vector v); @Override Iterator<MatrixSlice> iterator(); static final String KEEP_TEMP_FILES; }