downsample_matrix function

Downsample the columns of a matrix to a target number