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(); Configuration conf = TransposeJob.buildTransposeJobConf(initialConf, rowPath, outputPath, numRows); JobClient.runJob(new JobConf(conf)); 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 transpose(); @Override Vector times(Vector v); @Override Vector timesSquared(Vector v); @Override Iterator<MatrixSlice> iterator(); static final String KEEP_TEMP_FILES; }
@Test public void testTranspose() throws Exception { DistributedRowMatrix m = randomDistributedMatrix(10, 9, 5, 4, 1.0, false); DistributedRowMatrix mt = m.transpose(); mt.setOutputTempPathString(new Path(m.getOutputTempPath().getParent(), "/tmpOutTranspose").toString()); DistributedRowMatrix mtt = mt.transpose(); assertEquals(m, mtt, EPSILON); }
@Test public void testTranspose() throws Exception { DistributedRowMatrix m = randomDistributedMatrix(10, 9, 5, 4, 1.0, false); DistributedRowMatrix mt = m.transpose(); Path tmpPath = getTestTempDirPath(); m.setOutputTempPathString(tmpPath.toString()); mt.setOutputTempPathString(new Path(tmpPath, "/tmpOutTranspose").toString()); DistributedRowMatrix mtt = mt.transpose(); assertEquals(m, mtt, EPSILON); }