Matrix diagonal check for max distance wasn't actually checking diagonal but all cells

You were right! My previous code was not working at all! I have fix it so now it actually checks diagonal values to decide when to stop calculation.

Test are passing, please check I have changed some test as I think the expected value was wrong, let me know if there is something else I can't see.

Thanks, hope it helps.