Replace map-reduce with dot operator using DoubleMatrix