How are you planning to use these diagonals? This might help us make suggestions as to what is a reasonable approach. Accessing diagonals is not a natural operation for sparse matrices stored by rows or columns.
Barry On May 6, 2011, at 3:56 PM, Xiangdong Liang wrote: > Hello everyone, > > I am wondering whether there is some function like MatGetDiagonal to > get the k-th diagonal (above or below the main diagonal) of the matrix > A. If I have to write my own function, what built-in function should I > use to get a particular element of A? It seems that MatGetValues > returns a block of matrix. I guess if I only extract one element once, > it would not be efficient. Any suggestions? Thanks. > > Best, > Xiangdong
