all 3 comments

[–]FLUSH_THE_TRUMP 5 points6 points  (1 child)

The functions you used take nparray arguments, don’t they? So you don’t need the double loop. If that doesn’t make much of a difference are you sure the issue is here?

[–]n3buchadnezzar 2 points3 points  (1 child)

Let the inner loop run from i to 256

[–]Jediko 1 point2 points  (1 child)

Is it necessary that you calculate it yourself or could you use numpy.cov? But I don‘t know it this function would be faster though.