On Wed, 4 Jul 2007, Ignacio Diaz-Emparanza wrote:
If you want to use a matrix in a function pakage, the matrix
need to be declared previously...
I have just put in place a new Windows snapshot which should
have better error-reporting for user-defined functions.
As for the issue of "matrix needs to be declared previously",
there are two cases:
A. The matrix argument is direct or by-value, of type "matrix".
In this case it is indeed an error if you type a name to which
there corresponds no pre-existing matrix. This error should now
be flagged properly.
B. The matrix argument is indirect or by-reference, of type
"matrix *". In this case, if you type a name, and no matrix
exists of that name, a new "null matrix" [in fact, a 1 x 1 matrix
with value 0] will be created automatically and supplied as the
argument in question.
The point is that in case B it's plausible that the function is
not interested in the original content of the matrix. but is
rather offering to re-size and fill the matrix with something that
might be of interest to the caller. (Obviously, if you as the
writer of a function package actually expect valid incoming
information in such an indirect matrix argument, you'll have to
check for this.)
I've taken another look at the code, and I don't see anything
relevant that should differ between Linux and Windows -- though.
of course, I could have missed some weird subtlety!
Allin.