Suppose I have the following matrix in Matlab:
A = [1 2 3
4 5 6
7 8 9
3 2 1
6 5 4];
Now imagine that I'd like to have a vector as follows:
v = [1 4 7 3 6 0 0 0 0 0 0] + [0 0 0 2 5 8 2 5 0 0 0] + [0 0 0 0 0 0 3 6 9 1 4];
That is, I'd like to read A by columns but I want that the 2 last elements of each column are summed with the first 2 elements of the next column (the last element of the 1st column with the 2nd element of the 2nd column, the 4th element of the 1st column with the 1st element of the 2nd columns, etc.)
Now, if A has very large dimensions, how could I do this process efficiently without a loop?
Thanks for your answers.