Blitz logo

Blitz Support :

From: Navneet Dalal (Navneet.Dalal_at_[hidden])
Date: 2003-12-08 13:34:56


On Mon, 08 Dec 2003 15:47:30 +0200, Andrius Kurtinaitis
<andrius.kurtinaitis_at_[hidden]> wrote:

> Hello,
>
> I would like to define a function which could be used in an array
> expression and which takes three array expression arguments. I found
> macros which allow to define one- or two-argument functions, but not
> three... Is it very dificult to make a trinary function?

I too remember that once I needed a ternary operator. But at that time, I
was new to blitz and could not do it.

However, I just have been able to write ternary support classes for blitz.
The sample code is attached.
However, this code is written with assumption that your compiler supports
templates arguments in template parameters.
Look for

#define BZ_TEMPLATES_AS_TEMPLATE_ARGUMENTS

in blitz/config.h
If it is defined, it should work.

Also, since I have just written it, so I am not able to test it quite
well. Just let me know if there are any problems.

> Is it possible to call applyStencil with array expressions as arguments?

applyStencil takes upto 11 arguments. Why donot you pass your individual
arrays to applyStencil and evalulate the expression
in stencil code?

-navneet
PS: Julian, may be you add this code to blitz? The code is pretty straight
forward. Just extended Binary Expression classes for ternary operators.