This would be brilliant.

Sure it would be useful in some contexts. I am on the way to convert some old
scripts I wrote in SPSS matrix processing language some (long) time ago. I
plan to propose the Moran and Geary spatial correlation coefficients first.
They are used as residuals mispecification tests when a regression model uses
data related to a spatial context (States, counties, measure stations,
etc...).
One of the thing planned for future versions is a function for
reading/writing matrices from/to csv files. Would this be useful to you?

That would be exactly what is needed for the task. In fact most spatial
analysis toolboxes / softwares proceed exactly that way around.
The data and the spatial context are stored in different files. For example,
in SPSS I had a SAV file and a text file with the neighborhood in vectorized
form.
First I load the data and the neighborhood vector, then I expand it into a
contiguity matrix (a binary matrix C, where C[i,j] = 1 if spatial unit j is a
neighbor of i, zero if not). Then I use the built contiguity matrix to compute
spatial statistics and perform tests.
The proposition you mentioned would do perfectly the job. The problem I had is
that the formats of the data and neighbor matrix are different so it is not
possible to load the data without loosing the matrix because only one datafile
can be opened at the same time!
So i had to translate my contiguity vector into a format that would allow it
to be inserted in the datafile. Let me more specific :
Let we have N spatial units (counties), indexed by i = 1..N
The spatial context may be stored in very diverse manners (I will write a
short note on that). The most compact form is the vectorized list of
neighbors: for each of the N spatial units we list only the index of the
neighbors (non zero entries). We thus have
INDEX | NEIGHBORS INDEX
1 9
1 102
1 45
1 33
...
N 12
N 99
N 118
N 78
Here i consider the 4-nearest neighbor matrix (the 4 nearest neighbors of each).
County 1 has county 9, 102, 45 and 33 as neighbors, etc...
this matrix is (4*N;2) so i had to transform it by third party application to
insert it into the data file:
INDEX NEIB1 NEIB2 NEIB3 NEIB4
1 9 102 45 33
2 ...
...
N 12 99 118 78
Then i can perform tests in GRETL.
I'm not sure I understand exactly what you mean, but in the
(unlikely)
case I do, you may use the mshape() function to put thing into place and
then convert the columns of the resulting matrix to series.

Oh right ! Sure I try it, may be faster than loops.
I will develop my sripts in very small example whose results are certified,
from papers and books.
>
> Two, do the matrix commands support the boolean product command ? It would
> be
> very useful for contiguity matrix handling purposes (ie, to compute the
> neighbors of neighbors, etc...).
What's the boolean product? You mean something like this?
<script>
nulldata 3
set seed 4385
matrix a = muniform(6,1)
matrix b = muniform(1,3)
matrix A = a > 0.5
matrix B = b > 0.5
A
B
matrix C = A*B
C
</script>

It seems so, it is simply AND, OR and things like that applied to matrices.
You know it is useful to compute unbiased higher order contiguity matrices
(ie; neighbors of neighbors, etc...).
> Three, if you are interested in this topic, I will gladly
contribute my
> developments to the community.
Please do!

Let's go on folks ! What about a small script with a short paper describing
what is done and why with references ?
cheers
Franck