Blitz logo

Blitz Support :

From: Navneet Dalal (Navneet.Dalal_at_[hidden])
Date: 2003-12-10 03:45:08


Hi Andrius,

By using the BZ_DECLARE_FUNCTION3 macro, overloaded versions of the
ternary functions are the provided.
Some struct's are also defined but they are internal to the blitz and
ideally these should not concern users.

Coming to your problerm (if I understood it right) you want to define, let
us say, two functions:

double gauss(double val, double mean, double var);
float gauss(float val, float mean, float var);

And then you would like to evaluate gauss on a Array<double,1> or on a
Array<float,1>.
For this, you just use BZ_DECLARE_FUNCTION3 as:

BZ_DECLARE_FUNCTION3(gauss);

int main() {
        Array<double,1> a(10);
        Array<float ,1> b(10);

        // initialize arrays
        Array<double,1> resA(10);
        resA = gauss(a, 0, 10); // 0 mean and 10 var

        Array<float ,1> resB(10);
        resB = gauss(b, 2, 5); // 2 mean and 5 var
}

If this is not the case, send a complete example of what you want.

On Wed, 10 Dec 2003 09:31:22 +0200, Andrius Kurtinaitis
<andrius.kurtinaitis_at_[hidden]> wrote:

> 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
>