code for generalized Frechet bounds