Update functions.R

add covariance matrix for X