Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: pointing to a class member function (likelihood) with optimize() in mata


From   Pierre-Carl Michaud <pcmichaud@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: pointing to a class member function (likelihood) with optimize() in mata
Date   Wed, 27 Oct 2010 23:05:32 -0400

In mata, I am trying to write a general class to estimate models. I have had no problem with optimize outside of a class. I want now to call optimize in the class and I have a problem with the line
  optimize_init_evaluator(s, &func())
The likelihood func() is a member function (method) in the class and as such referring to &func() does not find it. I've tried &classname::func() and no luck either. &this.func() does refer to something but then I get
  modelbase::func():  3001  expected 6 arguments but received 1
same error message if I define func() in the class definition as a static member function. Anyone has an idea of how to point to a class function so that optimize() finds it and its arguments?

Cheers,
Pierre-Carl.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index