writer.getValue(NullWritable.get()).size());
}
@Test
public void testMatrixDiagonalizeReducer() throws Exception {
MatrixDiagonalizeMapper mapper = new MatrixDiagonalizeMapper();
Configuration conf = new Configuration();
conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, RAW_DIMENSIONS);
// set up the dummy writers
DummyRecordWriter<NullWritable, IntDoublePairWritable> mapWriter =
new DummyRecordWriter<NullWritable, IntDoublePairWritable>();
Mapper<IntWritable, VectorWritable, NullWritable, IntDoublePairWritable>.Context
mapContext = DummyRecordWriter.build(mapper, conf, mapWriter);
// perform the mapping
for (int i = 0; i < RAW_DIMENSIONS; i++) {
RandomAccessSparseVector toAdd = new RandomAccessSparseVector(RAW_DIMENSIONS);
toAdd.assign(RAW[i]);
mapper.map(new IntWritable(i), new VectorWritable(toAdd), mapContext);
}
// now perform the reduction
MatrixDiagonalizeReducer reducer = new MatrixDiagonalizeReducer();
DummyRecordWriter<NullWritable, VectorWritable> redWriter = new