while ((row = peer.readNext()) != null) {
// it will be needed in conversion of output to result vector
peer.getCounter(RowCounter.TOTAL_ROWS).increment(1L);
int key = row.getKey().get();
double sum = 0;
SparseVectorWritable mRow = row.getValue();
if (v.getSize() != mRow.getSize())
throw new RuntimeException("Matrix row with index = " + key
+ " is not consistent with input vector. Row size = "
+ mRow.getSize() + " vector size = " + v.getSize());
List<Integer> mIndeces = mRow.getIndeces();
List<Double> mValues = mRow.getValues();
for (int i = 0; i < mIndeces.size(); i++)
sum += v.get(mIndeces.get(i)) * mValues.get(i);
peer.write(new IntWritable(key), new DoubleWritable(sum));
}
}