hi @N_Adhikari
for the code line instruction
the second mask to extract elements in the negative_zero_on_duplicate matrix that are larger than the elements in the diagonal
you have subtracted negative_zero_on_duplicate -positive which you don’t need to do.
only check if negative_zero_on_duplicate> elements in the diagonal.
All other codes are correct