Blitz logo

Blitz Support :

From: Andrius Kurtinaitis (andrius.kurtinaitis_at_[hidden])
Date: 2003-12-10 02:31:22


Hello,
what is the type of the defined ternary functions?
It seems it is a template struct. But is there some short way to specify
the type?
My problem is that I want to choose one of three functions which should
be used in an expression depending on some other parameter.
Andrius

Navneet Dalal wrote:
>
> 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.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support