Registered Member
|
I have a row-major matrix stored in memory (say A = 10x20 )
I'm interested in accessing columns of that matrix, and they're easier to work with if I treat each column as a matrix. That is, I want to map A.col(3) to a 2x5 matrix. If A was column-major this would be trivial, but since it's not, I have to tell Map what stride to use, and I'm having trouble getting code to compile. Can anyone please give me a pointer as to how to set this up? In the following code column3_as_2x5 should come out as [ 3 3 3 3 3; 3 3 3 3 3]
|
Registered Member
|
I had to draw the matrix to get the strides right, but heres the solution for mapping it to both column-major and row-major matrices:
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]