Generalized antireflection coatings for complex bulk metamaterials