change cost matrix into float
change arr to float corresponding to header