Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[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 <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index