forum.alglib.net
http://forum.alglib.net/

Error when using a member function in alglib::minlbfgsoptimi
http://forum.alglib.net/viewtopic.php?f=2&t=484
Page 1 of 1

Author:  franziss [ Tue Nov 15, 2011 3:57 am ]
Post subject:  Error when using a member function in alglib::minlbfgsoptimi

I have a class algo, which has a function algo::function1

when I run this
Code:
alglib::minlbfgsoptimize(state, &algo::function1);


It gives me the error

Code:
error C2664: 'alglib::minlbfgsoptimize' : cannot convert parameter 2 from 'void (__thiscall algo::* )(const alglib::real_1d_array &,double &,alglib::real_1d_array &,void *)' to 'void (__cdecl *)(const alglib::real_1d_array &,double &,alglib::real_1d_array &,void *)'


May I know what went wrong?Thank you!

Author:  Sergey.Bochkanov [ Tue Nov 15, 2011 11:20 am ]
Post subject:  Re: Error when using a member function in alglib::minlbfgsop

That's because ALGLIB needs non-member function pointer, and you pass pointer to the member function. You have to write non-member proxy() function which calls member function of your choice, and pass this proxy function to the ALGLIB.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/