eigen2hat function

Calculate the hat matrix from an eigen decomposition