To calculate the coherence of a matrix