You should check for every index where `nnz(i) != n`. Don't need to handle Double.MinValue / Double.MaxValue explicitly.