Re: [eigen] Re: inplace_transpose_selector

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

in the same file you'll find the declaration of inplace_transpose_selector:

template<typename MatrixType,
  bool IsSquare = (MatrixType::RowsAtCompileTime == MatrixType::ColsAtCompileTime) && MatrixType::RowsAtCompileTime!=Dynamic,
  bool MatchPacketSize =
        (int(MatrixType::RowsAtCompileTime) == int(internal::packet_traits<typename MatrixType::Scalar>::size))
    &&  (internal::evaluator<MatrixType>::Flags&PacketAccessBit) >
struct inplace_transpose_selector;

That means, currently the "true, true" variant is called only when the matrix is exactly packetsize x packetsize (e.g., Matrix4f or Matrix2d for SSE), the "true, false" for other square matrices and the "false, *" for non-square matrices (as the comments suggest).

But don't worry about these details too early. If you want to implement a more efficient transposeInPlace start with a separate function and benchmark it against the existing implementation. Once this is successful, the inplace_transpose_selector perhaps needs to be tweaked/re-implemented anyways.

Cheers,
Christoph


On 2016-03-26 21:41, Ivan Kush wrote:
We're calling /inplace_transpose_selector<Derived>::run. /What template
specialization will it choose?

*template*<*typename *Derived>
*inline void *DenseBase<Derived>::transposeInPlace()
{
    eigen_assert((rows() == cols() || (RowsAtCompileTime == Dynamic && ColsAtCompileTime == Dynamic))
                 &&"transposeInPlace() called on a non-square non-resizable matrix"); internal::inplace_transpose_selector<Derived>::run(derived()); }

This?

*template*<*typename *MatrixType>
*struct *inplace_transpose_selector<MatrixType,*true*,*true*> {// PacketSize x PacketSize

or this?

*template*<*typename *MatrixType>
*struct *inplace_transpose_selector<MatrixType,*true*,*false*> {// square matrix

the difference is only in the 3rd argument (in the /1st/ - it's ture, /2nd/ has
false)
--
Best wishes,
Ivan Kush
26.03.2016, 23:35, "Ivan Kush" <ivan.v.kush@xxxxxxxxx>:
Hello,
I'm lookong in the Eigen internals(want to be a bug fixer/contributor) and saw
such construction. Could you please explain why is this construction
/.*template* triangularView<StrictlyUpper>().?/
/m.matrix().*template*
triangularView<StrictlyUpper>().swap(m.matrix().transpose());/
--
Best wishes,
Ivan Kush
R&D Stadyo
Moscow, Russia


--
 Dipl. Inf., Dipl. Math. Christoph Hertzberg

 Universität Bremen
 FB 3 - Mathematik und Informatik
 AG Robotik
 Robert-Hooke-Straße 1
 28359 Bremen, Germany

 Zentrale: +49 421 178 45-6611

 Besuchsadresse der Nebengeschäftsstelle:
 Robert-Hooke-Straße 5
 28359 Bremen, Germany

 Tel.:    +49 421 178 45-4021
 Empfang: +49 421 178 45-6600
 Fax:     +49 421 178 45-4150
 E-Mail:  chtz@xxxxxxxxxxxxxxxxxxxxxxxx

 Weitere Informationen: http://www.informatik.uni-bremen.de/robotik



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/