Source: http://gerard.nin.free.fr/math/OptimisationCor.pdf