Am 05.08.2023 um 11:37 schrieb Riccardo (Jack) Lucchetti:
On the other hand, Sven's remark made me think that sometimes you
might want to compute all possible indices of a arbitrarily-sized
tensor. Once you have those, you can use them in a single loop without
having to nest many.
The function is:
...
So for example, you can create X = indices({2,3}), which would yield
1 1
1 2
1 3
2 1
2 2
2 3
...
The nice thing is, the number of elements in the argument to the
"indices" function is potentially unlimited. For example,
indices({3,2,3}) returns
1 1 1
1 1 2
1 1 3
1 2 1
1 2 2
1 2 3
2 1 1
2 1 2
2 1 3
2 2 1
2 2 2
2 2 3
3 1 1
3 1 2
3 1 3
3 2 1
3 2 2
3 2 3
Maybe we could add this to the extra addon?
I just don't want to leave this question dangling, but right now I don't
have an informed opinion, for example about the relation to the
powerset() function etc. In any case it cannot hurt much, can it?
thanks
sven