Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2007-02-18 19:44:42


"Matthias Troyer" <troyer_at_[hidden]> wrote in message
news:2F2BAA4A-9540-49EF-80F5-3E22D0A6B615_at_phys.ethz.ch...
>
> On 16 Feb 2007, at 19:47, Gennadiy Rozental wrote:
>
>>
>> "Matthias Troyer" <troyer_at_[hidden]> wrote in message
>> news:B503A931-963F-4F5B-8DCF-C6617D48EAAD_at_phys.ethz.ch...
>>>
>>> On 16 Feb 2007, at 19:24, Gennadiy Rozental wrote:
>>>
>>>>
>>>> Anyway. IMO almost any solution would be good enough for me.
>>>> v.update()
>>>> would work either.
>>>
>>> Why is
>>>
>>> acc(v);
>>>
>>> a problem if
>>>
>>> v.update();
>>>
>>> is fine?
>>
>> I never said it's a problem. But from what understand it's completely
>> different thing. acc(0) would be more close to v += 0; acc(v) is
>> more like
>> v *= 2;
>
> Now I'm really confused. acc is the accumulator, recording features
> like sum,min, max, mean, median, variance. In what sense is acc(0)
> like v +=0 and acc(v) like v *= 2????

Umm. I maybe wrong.

Here is correct correspondence (<==> means equivalent):

accumulator_set<....> acc;
tracked_var<....> v;

acc(s1) ; <==> v = s1;
acc(s2) ; <==> v = s1;
acc(s3) ; <==> v = s3;

v+=s1 doesn't really have anything corresponding in current interface. Maybe
something like this:

T value = 0;
accumulator_set<....> acc;
tracked_var<....> v;

value += s1;
v += s1; <==> acc(value);

value += s2;
v += s2; <==> acc(value);

value += s3;
v += s3; <==> acc(value);

value -= s4;
v -= s4; <==> acc(value);

value += 0;
v += 0; <==> acc(value);

If you think this as collecting samples of some variable values v+=0 look
pretty natural. if you think about it as accumulating set of values
acc(value) looks better.

Doesn't matter to me either way. It still does the same thing.

Gennadiy


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