Blitz logo

Blitz Support :

From: Mathias Wagner (mathias.wagner_at_[hidden])
Date: 2004-05-03 03:45:11


Hi,

I have some problems using user defined functions.
I did some testing with a very simple cpp file.

double f(double x){
return x*x;
}

BZ_DECLARE_FUNCTION(f);

int main(){

blitz::Array<double,1> b(3);
blitz::Array<double,2> A(3,3);

...

A = b(tensor::i) + 10*f(b(tensor::j));

...
}

Everything worked fine.

I now wanted to use a class method as user defined function.

Say class Aclass has a function
double f(double x, double y)

In a other class (say B) I would like to write

Aclass A(...);
blitz::Array<double,1> x;
blitz::Array<double,2> H;

H=A.f(x(tensor::i),x(tensor::j));

Has anyone an idea how to to this in an elegant way?

I tried to introduce a helper function in class B like

(in file b.h)
private:

double blitzhelp_f(double x,double y){
return A.f(x,y);
}

but this doesn't work.

Mathias