Replaced these nested for loops with a tidy BLAS call