Finished reduce_H_to_full_rank_matrix function.