C ++ matrix transformation. Increase uBLAS and double *?

I need to do a translation in place of a large matrix (so the easiest way to select another matrix and transpose it will not work). Unfortunately, this large matrix is ​​not square. And even worse, the matrix is ​​stored in an array of doubles with the number of columns and rows stored separately.

I found that boost has a uBLAS library, but I did not find a way to wrap my doubling array in a uBLAS matrix. Is there any way to do this?

Or do you recommend other ways to do this work?

+4
source share
3 answers

If you have very large matrices and you do not want to store temporary copies, one solution would be to turn your matrix array into a class and provide various adapters that will iterate through regular or transposed elements. This is not a very efficient cache, but saves memory on large matrices.

+2
source

As matrix operations go, transposing a matrix is ​​pretty easy to get right. I would recommend just doing it yourself and not worry about uBLAS (at least for this problem). There are several subtleties, but the Wikipedia article on transposition in place of the matrix is amazingly deep.

If you have little control over the presentation of data, you can do even better. If you have a matrix M with transposition T, then obviously M [x] [y] == T [y] [x], so depending on what you need for the transposed matrix, you may not need to perform what or transform data into everything.

+1
source

Depending on your specific use cases, you are right about a relatively large, non-square transposition. Basically compared to out-of-core , it seems like the biggest difference everyone cares about.

+1
source

All Articles