ENH: optimize: curve_fit now warns if pcov is undetermined

It might make sense to only fail for cases that are certainly incorrect, but not for those that are probably incorrect.
The PR also adds a warning for the pcov=inf case.