Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Plugins are here


From   [email protected] (Roberto G. Gutierrez, StataCorp.)
To   [email protected]
Subject   Re: st: Plugins are here
Date   Wed, 02 Jul 2003 11:07:05 -0500

German Rodriguez <[email protected]> writes:

> Plugins are here, see http://www.stata.com/support/plugins/.

> I believe there is an error in the documentation for accessing the data from
> a Stata plugin written in C. (This is rather technical, but will save you
> time if you are experimenting with this new feature.) The function with
> signature

> ST_retcode SF_vdata(ST_int i, ST_int j, ST_double *z) 

> is supposed to "read the ith observation of variable j in varlist and place
> this value in z", but i and j appear to be reversed: I think the first
> argument denotes the variable and the second the observation. (BTW both
> count from one, not zero).

[...]

German is right.  We will correct the documentation.  

German goes on to write:

> When it comes to matrices my spelunking shows that 

> ST_retcode SF_mat_el(char *mat, ST_int i, ST_int j, ST_double *z)

> does indeed "take{s} the [i,j] element of Stata matrix mat and stores it
> into z". So we have a bit of an inconsistency in the way matrices and the
> data in memory are handled in terms of rows and columns.

> Given that the plugin technology is so new I wonder if Stata could change
> the SF_vdata (and presumably SF_vstore) interfaces to conform to the
> documentation and maintain consistency between datasets and matrices.

German makes a valid point, but it is also nice to think in terms of variable
i, observation j, when working on your data (don't think of your data as 
existing in rows and columns, but instead as a set of vectors).  As such, we
think it best to leave the code as it stands.  Admittedly, under this system
the term "matrix" when referring to data is a bit confusing -- perhaps "array"
is a better word.  We will also make this change to the documentation.

Those wishing to have observation i, variable j, can simply include something
like 

#define mydata(i,j)	SF_vdata((j), (i))

at the top of their plugin code.

We thank German for the very quick feedback!

--Bobby
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index