Source: https://mathsstan.files.wordpress.com/2014/09/cours_barycentre_e_12-10-2013.pdf