i think now the question will be more clear
see we have access formula for elements in a matrix A[i][j] to an array[index]
using row major is
index=i*(no of columns)+j
similarily i want the mathematical formula for accessing the upper triangular elements in to an array using row major
Yes, that's what i understood after your reply...
I guess there must be something like dividing and using the rest of divisions between the position you want to get (index on B) and the length of the lines in the matrix...
I know it's wrong, but i guess it's something like this:
B[index]=a[index%n][i-index%n]
using a nxn size matrix.
Sorry, I can't help you very much on this. Just guessing...