Example usage for org.apache.mahout.math.hadoop DistributedRowMatrix transpose

List of usage examples for org.apache.mahout.math.hadoop DistributedRowMatrix transpose

Introduction

In this page you can find the example usage for org.apache.mahout.math.hadoop DistributedRowMatrix transpose.

Prototype

public DistributedRowMatrix transpose() throws IOException 

Source Link

Usage

From source file:com.mycompany.MyHadoopSamples1.TransposeJob.java

License:Apache License

public int run(String[] strings) throws Exception {
    addInputOption();/*from  w w  w. j a v  a  2  s.  co m*/
    addOption("numRows", "nr", "Number of rows of the input matrix");
    addOption("numCols", "nc", "Number of columns of the input matrix");
    Map<String, String> parsedArgs = parseArguments(strings);
    if (parsedArgs == null) {
        return -1;
    }

    int numRows = Integer.parseInt(parsedArgs.get("--numRows"));
    int numCols = Integer.parseInt(parsedArgs.get("--numCols"));

    DistributedRowMatrix matrix = new DistributedRowMatrix(getInputPath(), getTempPath(), numRows, numCols);
    matrix.setConf(new Configuration(getConf()));
    matrix.transpose();

    return 0;
}