Hello, I just saw from the release code of Eigen 3.0 that Eigen still do in-place transposition through a temporary matrix copy. This is problematic if the matrix is very big as there might not be enough memory to recopy it. I have already implemented an in-place transpose operation for dense matrices using a smarter algorithm, requiring much less memory as long as the matrix is not too elongated, and I am willing to help implement this feature in Eigen if you deem it interesting. If so, please help me getting started. Best, Charles
Sorry leaving this unattended for so long. If you are still interested, we could put your algorithm into Eigen 3.3
If someone is interested in implementing this, perhaps start with reading https://en.wikipedia.org/wiki/In-place_matrix_transposition and the quoted references. Make sure to benchmark your solution! If you have trouble integrating this into Eigen, start with a stand-alone method which, e.g., takes a Matrix<Scalar, Dynamic, Dynamic>& or a Scalar pointer and two dimensions.
Is this ticket still valid?
Yes, as far as I know, nobody has (re-) started working on it.
(In reply to cdubout from comment #0) > Hello, > > I just saw from the release code of Eigen 3.0 that Eigen still do in-place > transposition through a temporary matrix copy. > This is problematic if the matrix is very big as there might not be enough > memory to recopy it. > I have already implemented an in-place transpose operation for dense > matrices using a smarter algorithm, requiring much less memory as long as > the matrix is not too elongated, and I am willing to help implement this > feature in Eigen if you deem it interesting. > If so, please help me getting started. > Best, > > Charles Hello Charles. I wrote very efficient parallelized and AVX-vectorized code for trasposeInPlace() for symmetric dense std::complex<double> matrices (and also the memory efficient algorithm for special types of sparse matrices, see the bug# 1179). It does not involve any intermediate copies, can optimized to specific processor cache size via dedicated template parameter and more than 10 times faster than Eigen implementation for 600x600 matrices on my laptop. I tried to write the code which is easily extendable for general transpose() operation (i.e. to efficiently transpose the matrix of arbitrary shape into another memory location) but never extensively tested it. How about to share and distribute our efforts to improve this side of Eigen? For example, all vectorized code (which means almost all code) needs to be rewritten from scratch for double and int matrices. But I do not have time now to do it.
Hi Dmitry, it would still be nice if you could share your specialized version. In Eigen we already provide some low level abstraction function for transposing
(oops I hit "save change" by mistake) Hi Dmitry, it would still be nice if you could share your specialized version. In Eigen we already provide some low level abstraction function for transposing a block of packet: internal::ptranspose. This should help writing a generic and cross platform transposeInPlace. Your specialized version would help anyone who would like to give it a try!
(In reply to Gael Guennebaud from comment #7) > (oops I hit "save change" by mistake) > > Hi Dmitry, > > it would still be nice if you could share your specialized version. In Eigen > we already provide some low level abstraction function for transposing a > block of packet: internal::ptranspose. This should help writing a generic > and cross platform transposeInPlace. Your specialized version would help > anyone who would like to give it a try! Gael: 1) I am planning to make my project open-source, so that entire code will be available for interested people soon. I think that it contains several other pieces which might be relevant for Eigen project. So, I prefer to proceed step-by-step and finish with the Hypersparse feature first (looking forward for your feedback) unless there will be explicit interest from specific people. 2) Regarding ptranspose packets: There is a conceptual issue with current implementation of transposeInPlace for symmetric matrices. Many useful operations like reducing matrix in place to its (anti)symmetric, (anti)Hermitian parts, calculating Hermitian adjoint etc. require replacing (i,j)-th element with some function of (i,j)-th and (j,i)-th elements. I would suggest to allow transposeInPlace to take functor as an optional argument which would allow end users to implement custom transformations of this type (this is how it is implemented in my code, and in fact I almost never use bare transpose operations in practice).
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/226.