Serving the Quantitative Finance Community

 
User avatar
aprokopiw
Topic Author
Posts: 0
Joined: September 21st, 2007, 3:45 pm

NAG library with C++

February 12th, 2008, 3:28 pm

Hi,Does anybody here have experience using the NAG library with C++ ? The main problem I am having it is written mainly for C.For example, I want to write a GARCH fitting program, using the NAG library to do the optimization for the MLE. It made sense for me to have a GARCH class, and then have a log-likelihood function as a member function. But then there's the problem of a non-static member function cannot be passed as a static/non-member function, which the optimization procedure of NAG requires.There is a NAG_comm device but I can't find much info about it in the documentation.Has anybody use the NAG library with C++ classes/inheritence etc?In general, is the NAG library used a lot in the quant finance world? It seems good because at least you can worry about implementing the actually math finance pricing problems, and not worrying about having a super-slick optimization function, which is somewhat far away from finance.Thanks.
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

NAG library with C++

February 12th, 2008, 3:49 pm

Why not embed the NAG C stuff in your C++ classes? After all, you want an array of parameters as output? But maybe there is a reason why this is not possible. BTW I have not used NAG/C, so take my comment with some salt. QuoteThe main problem I am having it is written mainly for C.what does it look like, that C function? Calling a C function from C++ should be easy.PLAN C: do it all in Fortran??
Last edited by Cuchulainn on February 11th, 2008, 11:00 pm, edited 1 time in total.
 
User avatar
DominicConnor
Posts: 41
Joined: July 14th, 2002, 3:00 am

NAG library with C++

February 12th, 2008, 4:58 pm

NAG is mildly common in finance, indeed they are doing a Finance Focus this monthhttp://www.nag.co.uk/Market/NAG_Quant_Day_London_2008.asp I think for your purposes, you need a friend function, which gives you the access you need, without the issues with a member function.NAG imposes this constraint because in C++ a pointer to the class object is passed to all member functions, implicitly, ie it is there even though not in the formal parameter list.You can pass the friend function because it contains no "this" pointer.