Forwarded message:
>From petern@nada.kth.se Thu Nov 12 11:57:19 1998
Sender: petern@nada.kth.se
Message-ID: <364B136D.7460DFF9@nada.kth.se>
Date: Thu, 12 Nov 1998 17:57:17 +0100
From: Peter Nordlund <petern@nada.kth.se>
Organization: KTH, NADA, CVAP
X-Mailer: Mozilla 4.06 [en] (X11; I; SunOS 5.5.1 sun4u)
MIME-Version: 1.0
To: tveldhui <tveldhui@extreme.indiana.edu>
Subject: Re: Blitz++ Stencils
References: <199811121556.KAA21464@olympus.extreme.indiana.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi Todd,
Thanks for a quick reply.
tveldhui wrote:
>
>
> Are you doing "naked-people" detection??? :-)
- No, right now I'm mostly trying to find suitable tools for realtime
image processing and Blitz seems to be one of the best choises!!
- But I have read an article on that problem, I guess
you are referring to that article? :)
> Making a usable array-iterator has been on the to-do for quite some
> time. I'll try to make it a priority when I have some time to devote
> to blitz.
- Very good!
> Probably the best thing is to provide an overloaded -> operator
> for the array iterators. Then I think you could do:
>
> BZ_DECLARE_STENCIL4(hsvref, HSV, R, G, B)
> HSV->assignFromRGB(R,G,B);
> // HSV.ref().assignFromRGB(R, G, B);
> BZ_END_STENCIL
>
> Or I could change the operator* to return a reference rather than
> a value; currently it is
>
> T_numtype operator*()
> { return *data_; }
>
> maybe it should be
>
> T_numtype& operator*()
> { return *data_; }
>
> Then your stencil code would look like this:
>
> BZ_DECLARE_STENCIL4(hsvref, HSV, R, G, B)
> (*HSV).assignFromRGB(R,G,B);
> // HSV.ref().assignFromRGB(R, G, B);
> BZ_END_STENCIL
>
> Let me know what you think.
As for the operator* returning a reference, would that sacrifice speed
in some circumstances maybe?
If you just add an operator->
you would use foo->setData(3) for mutating function calls
and (*foo).getData() or foo->getData() for nonmutating calls, maybe
that is a good idea? Then the user has a choise if he wants to use
a call returning by reference or value.
You probably know more about whether returning
value or reference for operator* is of importance for the speed.
I thought there was some deeper thoughts behind the original
choise of letting the operator* return by value, wasn't it?
It was quite some time ago I looked at this stuff so I don't remember
all
details, but speed is of course the most important issue, so if that
could differ, choose the fastest (needless to say, I guess).
By the way, I'm very impressed by your work, even if I ask you
solve a lot of my own problems.
Have you thought anything about boundary conditions? :-)
Regards,
Peter
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 04:30:08 EST