[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: how to access a matrix in a plugin
I have problems to understand the ST_mat_el() and ST_mat_store()
commands that pass matrices between Stata and my plugin. Here is my
tempname inmat outmat
mat `inmat' = (1,2 \ 3,4)
mat `outmat ' = ([.,.] \ [.,.])
plugin call intooutmat, `inmat' `outmat'
matrix list `B'
The task is to pass both matrices (inmat and outmat) to the plugin.
Then access inmat and get all of its contents into a C variable, then
possibly do some computations with this variable in C and finally
store the results (which happen to have the same dimensions as the
inpmat) into outmat so Stata can access the output of my computation.
For now, I can do this with a single elment of inmat:
STDLL stata_call(int argc, char *argv)
ST_double z ;
SF_mat_el( argv , 1 , 2 , &z ) ;
SF_mat_store( argv , 1 , 2 , z ) ;
This takes the element from the first row second column of inmat, puts
it into z, and then puts z into the first row second column of outmat.
But how can I access the WHOLE matrix inmat in the plugin (not just
element by element) and pout it into outmat?
Thank you very much for your help.
* For searches and help try: