Addressing an element T[h][w][c] in a linearized 3D tensor with 0-based indexing:
T[h*W*C+w*C+c]
with 1-based indexing: T[(h-1)*W*C+(w-1)*C+c]
Or let's say you want to take a string "abc" and repeat it until the length is 10, getting "abcabcabca". With 0-based indexing: a,b = "abc", [" "]*10
for i in range(0,10):
b[i]=a[i%3]
In a 1-based language that's: for i in range(1,11):
b[i]=a[(i-1)%3+1]
Here's what Dijkstra has to say about it:http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EW...