Wait, this is just doing A'A? Am I misunderstanding, or is this not most
easily done by first transposing A into A', and then doing the outer
products
instead of the inner products:
class Map extends Mapper<IntWritable, Vector, NullWritable, Matrix> {
map(IntWritable i, Vector v, Context c) { c.write(NullWritable.get(),
v.cross(v)); }
}
class Reduce extends Reducer<NullWritable, Matrix, NullWritable, Matrix> {
Matrix out;
reduce(NullWritable n, Iterable<Matrix> it, Context c) {
for(Matrix m : it) out = out.plus(m);
c.write(n.get(), m);
}
}
Then the outer products are computed in the mapper, and the sum is done in
the
combiners and single reducer.
Not sure how you'd fold in sparsification to that though.
-jake