You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by gs...@apache.org on 2011/11/05 17:23:46 UTC

svn commit: r1197984 - /mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java

Author: gsingers
Date: Sat Nov  5 16:23:46 2011
New Revision: 1197984

URL: http://svn.apache.org/viewvc?rev=1197984&view=rev
Log:
minor doc

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java?rev=1197984&r1=1197983&r2=1197984&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java Sat Nov  5 16:23:46 2011
@@ -43,6 +43,9 @@ import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;
 
+/**
+ * Transpose a matrix
+ */
 public class TransposeJob extends AbstractJob {
 
   public static final String NUM_ROWS_KEY = "SparseRowMatrix.numRows";
@@ -56,7 +59,7 @@ public class TransposeJob extends Abstra
     addInputOption();
     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);
+    Map<String, String> parsedArgs = parseArguments(strings);
     if (parsedArgs == null) {
       return -1;
     }
@@ -76,7 +79,7 @@ public class TransposeJob extends Abstra
                                                     int numInputRows) throws IOException {
     return buildTransposeJobConf(new Configuration(), matrixInputPath, matrixOutputPath, numInputRows);
   }
-  
+
   public static Configuration buildTransposeJobConf(Configuration initialConf,
                                                     Path matrixInputPath,
                                                     Path matrixOutputPath,
@@ -104,7 +107,7 @@ public class TransposeJob extends Abstra
   }
 
   public static class TransposeMapper extends MapReduceBase
-      implements Mapper<IntWritable,VectorWritable,IntWritable,VectorWritable> {
+          implements Mapper<IntWritable, VectorWritable, IntWritable, VectorWritable> {
 
     private int newNumCols;
 
@@ -115,7 +118,7 @@ public class TransposeJob extends Abstra
 
     @Override
     public void map(IntWritable r, VectorWritable v, OutputCollector<IntWritable, VectorWritable> out,
-        Reporter reporter) throws IOException {
+                    Reporter reporter) throws IOException {
       int row = r.get();
       Iterator<Vector.Element> it = v.get().iterateNonZero();
       while (it.hasNext()) {
@@ -129,21 +132,21 @@ public class TransposeJob extends Abstra
   }
 
   public static class MergeVectorsCombiner extends MapReduceBase
-        implements Reducer<WritableComparable<?>,VectorWritable,WritableComparable<?>,VectorWritable> {
+          implements Reducer<WritableComparable<?>, VectorWritable, WritableComparable<?>, VectorWritable> {
 
     @Override
     public void reduce(WritableComparable<?> key, Iterator<VectorWritable> vectors,
-        OutputCollector<WritableComparable<?>, VectorWritable> out, Reporter reporter) throws IOException {
+                       OutputCollector<WritableComparable<?>, VectorWritable> out, Reporter reporter) throws IOException {
       out.collect(key, VectorWritable.merge(vectors));
     }
   }
 
   public static class MergeVectorsReducer extends MapReduceBase
-        implements Reducer<WritableComparable<?>,VectorWritable,WritableComparable<?>,VectorWritable> {
+          implements Reducer<WritableComparable<?>, VectorWritable, WritableComparable<?>, VectorWritable> {
 
     @Override
     public void reduce(WritableComparable<?> key, Iterator<VectorWritable> vectors,
-        OutputCollector<WritableComparable<?>, VectorWritable> out, Reporter reporter) throws IOException {
+                       OutputCollector<WritableComparable<?>, VectorWritable> out, Reporter reporter) throws IOException {
       Vector merged = VectorWritable.merge(vectors).get();
       out.collect(key, new VectorWritable(new SequentialAccessSparseVector(merged)));
     }