Subject: Re: [proto] Using proto with expressions containing matrices from the EIgen library
From: Eric Niebler (eric_at_[hidden])
Date: 2010-11-18 12:33:04
On 11/18/2010 9:28 AM, Bart Janssens wrote:
> On Thu, Oct 28, 2010 at 7:47 AM, Eric Niebler <eric_at_[hidden]> wrote:
>> You should be asking yourself why you're trying to return expression
>> templates from a function. If you really need to do that, then you can't
>> go returning references to temporary objects.
> Hi guys,
> Just wanted to provide some closure to the subject, the Eigen
> developers provided me with a workaround that allows to store
> expression template operands by value instead of by reference, and
> they in fact opened a bug to better support the use case I brought up
Thanks for the update. That bug report is an interesting read. I
remember going through the same deliberations 5 years ago when I first
wrote Proto. And then again with Joel and Hartmut when Sprit2 moved to
Proto. (Remember the whole "flattening" argument?) They've come to
realize that they shouldn't be doing any fancy computation during ET
construction, and use separate "evaluators". But they seem to be
conflating node storage with expression evaluation, which are orthogonal
issues. (I may have simply misunderstood their design discussion.) They
also need something like Proto's expression extension mechanism, so that
their expression tree objects can still have the direct ceoff access
syntax they need.
Anyway, I'm very glad we don't have these problems anymore with Proto.
> I am also following your suggestion to use transforms, since right now
> I'm mixing proto::eval and some transforms, but as I finally
> understand transforms a little better, it seems they can simplify my
> code quite a lot in this case.
Glad to hear it. I'm considering going through the docs and examples and
yanking most references to contexts and proto::eval. Transforms seem are
harder at first, but in the end they're really much simpler.
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Proto list run by eric at boostpro.com