Hi, I am writing a mata source code.
In my code, the structure is as follows:
I expected that the function my_deriv() works because both my_deriv() and my_obj() are declared and defined in the same class.
But, when I implemented this code like below
The following error is returned:
my_class::my_deriv(): 3499 my_obj() not found
<istmt>: - function returned error
What is the problem here?
In my code, the structure is as follows:
Code:
mata:
class my_class {
public:
void my_obj(), my_deriv()
}
void my_class::new() {
some objects
}
void my_class::my_obj() {
function's body
}
void my_class::my_deriv() {
transmorphic D
real matrix scores, Hessian
D = deriv_init()
deriv_init_evaluator(D, &my_obj()) // Note here
continue ...
}
end
But, when I implemented this code like below
Code:
mata: m = my_class() mata: m.my_deriv()
my_class::my_deriv(): 3499 my_obj() not found
<istmt>: - function returned error
What is the problem here?

Comment