Found a bug in calculating d. For covariance, d is quadratic in k, not
linear.