Problem with interior.h
Yafeng
02-05-2010, 12:07 PM
Hi there,
I was trying to include interior.h in one of my program, but I got a message because that interior.h includes another two head files ldl.h and amd.l which are seemingly not included in the NR head files nor in the C++/C library. Could anyone tell what I should do here to get around this problem? Thanks.
Yafeng
Biostat UCLA
MPD78
02-05-2010, 04:22 PM
The interior.h header file has the following includes
#include "nr3.h"
#include "sort.h"
#include "sparse.h"
#include "interior.h"
Here is a link to the dependencies tool.
http://www.nrbook.com/nr3/
The two files that you are missing are located in Webnote 13 Rev. 1
Hope that helps.
Thanks
Matt
davekw7x
02-05-2010, 05:26 PM
...but I got a message because that interior.h includes another two head files ldl.h and amd.l which are seemingly not included in the NR head files...
As mentioned in the book, external libraries LDS and AMD are required.
Source for these libraries can be obtained here: http://www.cise.ufl.edu/research/sparse/amd/ and here: http://www.cise.ufl.edu/research/sparse/ldl/
Untar and compile the source for each. Observe the note in the text:
Near the end of LDL_numeric() that authors recommend that you change the line
if (D [k] == 0.0) return (k) ; /* failure, D(k,k) is zero */
to something like
if (D[k] < 1.0e-40) {
D[k] = 1.0e128;
}
I recommend that you build the LDL stuff first using the unmodified source code, and if it is successful then try the change.
Linux/gcc users can use GNU make very easily if you download and untar UFconfig.tar.gz from http://www.cise.ufl.edu/research/sparse/UFconfig/ Look in the Makefiles to see where to put the stuff.
Build both libraries (with "make library" in each base directory) then copy amd.h and ldl.h to /usr/local/include (watch for proper permissions). Also copy libamd.a and libldl.a to /usr/local/lib. For building your application, use "-lamd -lldl" command line switches with g++ for linking. At least it works that way for me. (Centos 5.4 with gcc version 4.1.2)
Your Mileage May Vary.
Regards,
Dave
MPD78
02-05-2010, 06:36 PM
... external libraries LDS and AMD are required.
Sorry to the original poster. I didn't realize that you had to go outside the book.
Thanks
Matt
Yafeng
02-08-2010, 12:42 PM
Thank both of you.
Following Dave's suggestion, I downloaded and untar UGconfig, AMD, LDL to ../nrc where I store all my NR headfiles. Then within AMD and LDL, I used make lib and compiled them respectively, and got libamd.a and libldl.a in AMD/Lib and LDL/lib respectively.
Then I tried to copy libamd.a and libldl.a to /usr/local/lib, and amd.h and ldl.h to /usr/local/include, but I dont have the permission to do this. So I just copied amd.h and ldl.h to /nrc, and also created directory called /nrc/lib, and copied libldl.a to /usr/local/lib (not sure if this is necessary). Again, I compiled the list of headfiles that I needed to, including interior.h, and this time it worked.
If there is any problem in what I did, please tell me. Thank you very much!