![]() |
Blitz Support : |
From: Julian C. Cummings (cummings_at_[hidden])
Date: 2004-02-06 16:06:02
Hello Navneet,
OK, this sounds like a good compromise between disabling this feature (as it
is now) and adding the feature to the original BZ_DECLARE_FUNCTION2 macro as
you had first requested. I was waiting to see if others would chime in on
this issue, but no one did. I was reluctant to modify the behavior of the
BZ_DECLARE_FUNCTION2 macro because these macros were originally intended to
extend functions acting on scalar arguments to act on blitz Arrays of
scalars, not combinations of Arrays and scalars. Nevertheless, it is true
that there exist binary functions such as pow() in which one of the
arguments acts like a parameter (e.g., the exponent).
I will add a BZ_DECLARE_FUNCTION2_SCALAR macro as you have suggested. (Note
the slightly different name from your suggestion in order to match existing
convention.) I would continue to encourage everyone to consider using
functors instead of functions in cases where one or more function arguments
act as fixed parameters for a function (i.e., state). This is a more
flexible and extensible approach than trying to create functions acting on
blitz Arrays that take 3 or more arguments.
Regards, Julian C.
Dr. Julian C. Cummings
Staff Scientist, CACR/Caltech
(626) 395-2543
cummings_at_[hidden]
> -----Original Message-----
> From: Navneet Dalal [mailto:Navneet.Dalal_at_[hidden]]
> Sent: Friday, February 06, 2004 11:50 AM
> To: Julian C. Cummings
> Subject: BZ_DECLARE_FUNCTION2 and scalar arguments
>
>
> Hi Julian
>
> I updated my blitz with the current cvs version. I can see
> that you have added functions and macros for scalar arguments
> with functor objects.
>
> However, one small thing is missing. The macro below
> requires the name of applic class.
>
> #define BZ_DECLARE_ARRAY_ET_BINARY_SCALAR(name, applic, sca)
>
> Since, normally, a user is unaware of applic class.
> So may be we should also add a macro which hides the applic
> details and is more in sync with BZ_DECLARE_FUNCTION2 macros.
>
> for e.g. I added the following two lines to newet-macro.h on
> my computer
>
> #define BZ_DECLARE_FUNCTION2_ARG_SCALAR(name, sca) \
> BZ_DECLARE_ARRAY_ET_BINARY_SCALAR(name, name ## _impl, sca)
>
> This way, by just using BZ_DECLARE_FUNCTION2, the scalar
> argument functor will not come in scope and if a user really
> wants a scalar argument functor, he can call
> BZ_DECLARE_FUNCTION2_ARG_SCALAR(name, sca)
> with required scalar argument type.
>
> regards
> -navneet
> --
> Navneet DALAL http://www.inrialpes.fr/lear/Dalal
> INRIA Rhone-Alpes Ph(work): +33 (0)476 61 54 97
> ZIRST-655, av. de l'Europe - 38334 FAX : +33 (0)476 61 54 54
> Montbonnot St. Martin, France Mobile : +33 (0)677 54 33 33
>