Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-03-07 19:04:31


----- Original Message -----
From: "rwgk" <rwgk_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, March 07, 2002 6:26 PM
Subject: [boost] Re: std::complex design (Was: N-Dimensional array
library

> --- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:

> > I can't believe that Blitz++ spends any significant fraction of
> those
> > lines avoiding initialization.
>
> Good point.
> But don't the expression templates constitute a major fraction of
> the code? Isn't that Todd's way of getting around the initialization
> problem?

No! That's his way of avoiding the creation of expensive intermediate
results and preserving locality-of-reference:

HugeArray add5(HugeArray a, HugeArray b, HugeArray c, HugeArray d,
HugeArray e)
{
    return a + b + c + d + e;
}

How many HugeArrays get created? In Blitz++ it's just 1.

> Going off on a tangent: the array family algebra does not avoid the
> temporaries, but it works around the initialization problem. I have
> not done any timings, but I suspect (well, hope) that the performance
> penalty with respect to Blitz++ is small.

I think you'd better do some measurements on complex array expressions
before making that statement. The whole point of Blitz++ is that the
library can see and analyze the entire expression before evaluating it.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk