Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case*From*: Marc Glisse <marc.glisse@xxxxxxxx>*Date*: Mon, 16 Jun 2014 18:54:05 +0200 (CEST)

On Mon, 16 Jun 2014, Christoph Hertzberg wrote:

On 16.06.2014 17:02, Marc Glisse wrote:On Mon, 16 Jun 2014, Christian Seiler wrote:There has been a proposal for 'operator auto' in C++ because of this, but there doesn't seem to be enough traction for it.The latest related paper is: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4035.pdf and the committee will discuss it this week. If you have any comments, please feel free to post them on: https://groups.google.com/a/isocpp.org/forum/#!forum/std-proposals There is some resistance to this kind of change, so any extra information (use cases, requirements, suggestions, etc) helps, not least because it shows interest in the proposal.While I like the idea in general, I'm not totally sure about that either.

This can bring very strange performance differences when switching betweendifferent C++ versions.In some cases it might even degrade performance, e.g.:

auto AB = A*B; // shall this evaluate into a temporary?

Write auto&& (or auto const&) if you don't want value semantics.

MatrixXd result = AB+C; // actually, no explicit temporary AB required // direct evaluation would have been better

What would also be confusing is that passing a product to template<class Matrix> void foo(const Matrix&); will not do automatic 'auto'-conversion, but this would: auto X = expression; // auto-conversion foo(X); // converted X foo(expression); // no conversionI think the best thing we can do on our side (and we can do thatindependently of changes in the standard) is to warn users about pitfallswith the auto-keyword. E.g., we could create a doxygen-page for that and linkit prominently (from all starting guides, etc).I posted a bug for that: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=825

I added a similar warning to the GMP manual some time ago: https://gmplib.org/manual/C_002b_002b-Interface-Limitations.html -- Marc Glisse

**Follow-Ups**:**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case***From:*Christoph Hertzberg

**References**:**[eigen] Matrix multiplication seems to be exceptionally slow in one specific case***From:*Thijs.Kooi

**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case***From:*Christian Seiler

**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case***From:*Marc Glisse

**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case***From:*Christoph Hertzberg

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case** - Next by Date:
**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case** - Previous by thread:
**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case** - Next by thread:
**Re: [eigen] Matrix multiplication seems to be exceptionally slow in one specific case**

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