cache inverse covariance matrix to avoid multiple computations
add -O2 flag to improve performance