made reducer.py work with transposed matrices