fromto_to_mat