Creating a matrix of vectors in C ++ using uBLAS

If I have n vectors of length m and you want to join them to create the mxn matrix, then what is the most efficient way to do this in C ++ using Boost uBLAS?

Obviously, I can just loop into them and assign each matrix element an appropriate vector value, but I feel that there is a better way to do this that I don’t know about.

+4
source share
1 answer

Instead of repeating the entire list of vectors by elements, I would try to assign each of your vectors directly to the corresponding column.

template<class AE > BOOST_UBLAS_INLINE matrix_column & operator= (const vector_expression< AE > &ae) 

You need to copy each element at some point, but it should be faster than a nested loop (or the primary error in Boost.uBlas, if not).

+2
source

All Articles