Magnetization of ellipsoids of nonideal superconductors