I thought this problem had a trivial solution, couple of for loops and some fancy counters, but apparently it is rather more complicated.
So my question is, how woul
you have to break the matrix in to upper and lower parts, and iterate each of them separately, one half row first, another column first. let us assume the matrix is n*n, stored in a vector, row first, zero base, loops are exclusive to last element.
for i in 0:n
for j in 0:i +1
A[i + j*(n-2)]
the other half can be done in a similar way, starting with:
for j in 1:n
for i in 0:n-j
... each step is i*(n-2) ...