Updated CountNonZerosInDiagonal.