fix the dimensions of the input binary matrix