8.5.11   Elementwise Comparison Operations

These comparison operations compare the input tuples t1 and t2 elementwise. If both tuples have the same length, the corresponding elements of both tuples are compared. Otherwise, either t1 or t2 must have length 1. In this case, the comparison is performed for each element of the longer tuple with the single element of the other tuple. As a precondition for comparing the tuples elementwise two corresponding elements must either both be (integer or floating point) numbers or both be strings.

Operation Meaning HALCON operator Alternative notation

t1 [<] t2 less than tuple_less_elem
t1 [>] t2 greater than tuple_greater_elem
t1 [<=] t2 less or equal tuple_less_equal_elem
t1 [>=] t2 greater of equal tuple_greater_equal_elem
t1 [==] t2 equal tuple_equal_elem t1 [=] t2 (legacy)
t1 [!=] t2 not equal tuple_not_equal_elem t1 [#] t2 (legacy)

Table 8.17: Elementwise comparison operations.

1st Operand Operation 2nd Operand Result

[1,2,3] [<] [3,2,1] [1,0,0]
['a','b','c'] [==] 'b' [0,1,0]
['a','b','c'] [<] ['b'] [1,0,0]

Table 8.18: Examples for the elementwise comparison of tuples.