Armadillo - how to extract rows?
armadillo, c++
Solution
Armadillo stores data column-by-column (for compatibility with LAPACK), so extracting columns via .colptr() is the preferred approach. You can refactor your code so that your data is stored column-by-column instead of row-by-row. One brute-force approach to accomplish this is to transpose the matrix.
Problem
I'm using Armadillo C++ library for matrices. I would like to copy some of the rows to an external array (I need to copy them to the gpu). Is there a fast way to do this? If I use `.rows` , it gives me a subview with no access to data pointers, so I must iterate on the values and copy them one by one. This is very slow. Is there another option? Thanks.