Optimizing a Halbach cylinder for field homogeneity by remanence variation