Assume you have a symmetric square matrix sigma
Is there an (computationally) efficient way to extract some of the off-diagionals? For example in the example code, you get
I would like to end up with a vector that for example takes the first and second off-diagonal, that is
In my actual purpose, the number can be anything, not necessarily this nice sequence of integers. The matrix can be very large and the operation executed many times, hence why a somewhat efficient solution would be useful. So far, I haven't managed to find one yet, even though I feel it should not be that complicated. Some select(sigma, ???) magic could do it I think, but again, I haven't managed to find the right syntax. E.g. in pseudo code, it could be something along the lines of select if (row-column)<3 & (row-column) > 1 (I think).
Code:
T = 6 sigma = invvech((1 .. T*(T+1)/2)')
I would like to end up with a vector that for example takes the first and second off-diagonal, that is
Code:
2 8 13 17 20 3 9 14 18
Comment