need help quick -- problem using tqli()


zhasanain
05-13-2004, 06:36 AM
Hi all,

I've copied the code for tred2() and tqli() into my VC++ project. tred2() works properly, but when i try to run tqli(), it gives me the following compilation error:

error C2065 : SIGN : undeclared identifier

This error arises from line 36 of the tqli() code, which is:

g=d[m]-d[l]+e[l]/(g+SIGN(r,g)); //This is dm - ks.

Does anyone know why this is happening? The SIGN macro hasn't been defined in either nr.h or nrutil.h. Do i have to include any other files to make this work?? I'm lost

It'd be really helpful if i could get an answer sooon, coz my project is due in a few days' time!!

Zehra

:confused: :confused:

jaje
05-13-2004, 11:22 AM
Are you sure? SIGN() is supposed to be one of the macros included in the header file...

Anyway, here's the macro declaration:

#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))

Hope this helps...

Jan M. (^_^)

jaje
05-13-2004, 11:28 AM
Ah, here it is: you need the following files, too:

nrutils.h
nrutils.c

That's where SIGN(), SQR(), and all the other useful macros are located.

Jan M. (^_^)

zhasanain
05-14-2004, 03:17 AM
Thanks for ur prompt reply :)

I've searched for the macro definitions in nr.h, nrutil.h and nrutil.c, but they aren't there. So i've added the definition u gave to the top of my file (thanks!). However, now i also need the definition for the SQR macro to be able to execute pythag(). Could u please provide me with that as well? It would be a great help.

Also, why don't i have these macro definitions in my files? Do u think i have the wrong files?? Is there a difference b/w nrutil.h and nrutils.h?? Because i have the one called nrutil.h

Any help would be valuable at this time, when my project is still struggling to lift off :)

Z