Source: http://www.iecl.univ-lorraine.fr/~Philippe.Chassaing/homepage/documents/coursCDM2017.pdf