In reply to dave_59:
“each row should have only one max element and rest less than max and can be repetitive”.
Does it mean - in each row only one element should have max value and all other elements must be less than that. ‘max’ is non-repetitive and others can be repetitive?
I made a minor change to make sure max is not repetitive.
// compute max_values and make unique
// one element is equal to the max value
// and check for max element not to be repeated
foreach (md_array[r]) {
md_array[r].sum() with (int'(item < max_value[r])) == odd_num-1;;
}