Fixed bug in reduce_dimensionality where the second matrix was not correctly made into the shape of the first