look at matrix_indirect: http://www.boost.org/libs/numeric/ublas/doc/html/classboost_1_1numeric_1_1ublas_1_1matrix__indirect.html
You can make any submatrix with that.
David
Hi,
I am working a a project that I need to use a sub-matrix of a given
matrix, the MATLAB code is as follows:
>> M = reshape(1:18, 3, 6)
M =
1 4 7 10 13 16
2 5 8 11 14 17
3 6 9 12 15 18
>> subM = M(2:3, [1, 4, 6])
subM =
2 11 17
3 12 18
the subM is the one I want. I understand there are very convenient
tools 'range' and 'slice' but I am trying to get a general one such as
[1, 4, 6] in the previous example.
In addition, I read the thread on
http://archives.free.net.ph/message/20100723.123350.753d32ba.en.html
using indirect_array but I want a better one such as indexing the rows
with range by the columns with indirect_array.
I know I can do it by constructing a new matrix with elements from the
original matrix but I want a more efficient one so I can save a little
memory when dealing with large=scale matrix.
Thanks
Bin
_______________________________________________
ublas mailing list
ublas@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: david.bellot@gmail.com