SlowGuess/NeurIPS_2023_OCR huggingface dataset:
for all TT-cores except the last one  $(k = 1,2,\ldots ,d - 1)$ , and for the last TT-core
$$
f _ {0} ^ {d} (x) = \left\{ \begin{array}{l l} 1, & x = 0 \text {o r} x = l \\ 0, & \text {o t h e r w i s e}, \end{array} \right.
$$
$$
f _ {1} ^ {d} (x) = \left\{ \begin{array}{l l} 1, & x \geq l - 1 \\ 0, & \text {o t h e r w i s e .} \end{array} \right.
$$
A tensor in the TT-format built on such derivative functions is equal to 0 if there are less than  $l$  ones among its vector argument in a row, and is equal to 1 in all other cases.
Let us briefly explain why such derivative functions give a tensor of the restriction condition (i.e., the constraint in the considered optimal control problem). Recall that the upper index in the derivative function notation corresponds to the index number of the tensor argument, and the lower index corresponds to the value of this argument index. In our scheme, the argument of the derivative functions has the meaning of the number of ones that already stand to the left of the given index.
First, let us focus on the functions for all indices except the rightmost one ( $k = 1,2,\ldots ,d - 1$ ). If the current index is one, then we simply increase the value of the argument by 1 and pass it on, to the input of the next derivative function. This is what the function  $f_{1}^{k}$  does (we take the maximum, so if the number of ones has already reached  $l$ , we do not care if it is greater than or equal to  $l$ ; note that the maximum operation reduces the TT-rank but does not affect the result). For the zero value of the current index, if the argument is zero (which means that the previous index is also zero), the function  $f_0^k$  also returns zero as nothing have changed. If the argument of this function is  $l$ , it means that there are  $l$  or more ones in a row to the left of the considered index, so the given condition is not violated, and the function simply returns zero, which means that there are no ones. If the argument is greater than zero but less than  $l$ , it means that the condition is violated because the previous sequence of ones of length less than  $l$  is cut off at the current index. In this case, the function  $f_0^k$  returns None, which means that the value of the tensor will be 0 regardless of the subsequent indices.
The functions corresponding to the last  $(k = d)$  index behave similarly. Namely, if the last index is zero, the function  $f_0^k$  returns 1 if its argument is 0 or  $l$  since it does not violate the condition as just explained. Otherwise, it returns 0. If the last index is 1, the function  $f_1^k$  returns 1 only if its argument is equal to  $(l - 1)$  or  $l$  since this means that the current one is an element of a sequence of ones of length at least  $l$ . Otherwise, the function  $f_1^k$  returns 0.