Let us suppose that we have an array ordered
. We want to check if the sub-arrays t
and t_inv
are following the same order as the imposed order inorder
array.
Reading from left to right: the first element is [0,0]
and so on until [0,3]
.
t_inv
is inversed because the first to elements are swapped, they do not follow the ordering as in ordered
.
# imposed order
ordered = jnp.array([[0, 0],[0,1],[0,2],[0,3]])
# array with permuted order
t = jnp.array([[[0, 0],[0, 1], [0,3]]])
t_inv = jnp.array([[[0, 1],[0, 0], [0,3]]])
I expect the following:
result: ordered(t) = 1, because "ordered"
and ordered(t_inv) = -1, because "swapped/not ordered"
How can you check that the sub arrays are indeed part of the ordered array and ouput whether the order is correct or not?
ordered
array relate tot
andt_inv
? When you say "the first elements are swapped", which elements oft_inv
are you talking about, and how do they relate to what is specified inordered
? Is it important thatt
andt_inv
are three-dimensional arrays, or is that a typo?t
andt_inv
included pairs that didn't appear inordered
. Butt
andt_inv
are still three-dimensional – is that your intention?t
andt_inv
need to be a sub-array ofordered
. they don't necessarily need to have the same number of elements asordered
, but definitely their elements need to be contained inordered