[Gsll-devel] What is needed to fix matrix views?

Tamas K Papp tpapp at Princeton.EDU
Fri Apr 11 12:19:03 UTC 2008


On Thu, Apr 10, 2008 at 10:46:17PM -0600, Zach wrote:

> > What do you lose?  You can no longer use aref and array functions.
> > That is actually a big loss, that's why I didn't do it,
>
> One would hope that this isn't too big of a loss.  Different data types have
> different interfaces right.  Are you referring to the inability to use other
> peoples tools?

Yes.

> You mean in conjunction with the affine parameters?  You cannot encode the
> affine map in terms of :displaced-to and :displaced-index-offset, right?

I am not using the affine indexing code at the moment, I meant that
displaced arrays are general enough for my needs.

> > But the above is easy to do, I have
> > some code lying around if you are interested.
> 
> I am interested, could you post it?

I made it available at

http://www.princeton.edu/~tpapp/software/foreign-friendly-array.archived.tar.gz

Note that the code is not optimized, it was experimental.  Quite a few
design choices were refined in FFA, so just look at index-mapping.lisp
to get the idea, the actual foreign interface code is not that good
here.

Generally, I found that thinking a bit about my matrix/array layout
always allows me to implement what I want using CL's displaced arrays.
When R was my primary language, I found a lot of indexing magic nice,
but later realized that it is a pain in the rear end when you try to
optimize your applications.  Displaced arrays are a compromise, but I
found that they are general enough for my needs.  For example, with
row-major matrices, you can select a submatrix that contains all
columns of the original, or with columns dropped from the left, using
displaced arrays.

Tamas



More information about the gsll-devel mailing list