[Matrix-SIG] Numerical plans

Andrew P. Mullhaupt amullhau@zen-pharaohs.com
Fri, 10 Sep 1999 17:26:41 -0400


> Periodically the issue is raised of

> x[indices] = values
> x[indices] as an r-value

> being desireable, as it was recently.

And it will be, until it's in there or another more attractive language
comes along.

> As I pointed out before, everyone agrees that the above line is
desireable, but when > x has rank > 1, there are strongly differing views of
what this ought to mean. Multiple > intelligent, experienced developers have
told me that (a) I am an idiot, because (b)
> there is only one obvious and highly desireable solution, namely theirs
Unfortunately > the latter does not turn out to be the same in all cases.

I think these developers don't have much experience. There are clearly
multiple useful meanings that this can have. Especially depending on what
range indices can have in your language.

The one that probably makes the most sense is to coerce x to a rank-1 array,
and index that, return the rank-1 result. A lot of languages do that, and
nobody is banging on them to change.

> The issue is complicated by the fact that the coding for setindex is
already totally
> incomprehensible and so changing it requires a great deal of care and
testing.

Time for a replacement. There are some methods for indexing which are both
simpler and can be substantially faster.

> It is time for proposals. Concrete, detailed. Discussion to follow. If we
can come to a > consensus it would be nice.

Steal the S style, except you probably can't get away with the special
treatment of nonpositive index values and sparse indexing by high rank
arrays.

The APL style is better thought out in terms of language design, but then
you need to add more functions for the stuff cyclic extension does for you,
and the code you have to write isn't as fast. Experience has shown that the
APL approach was probably too rigid.

Later,
Andrew Mullhaupt