help with gross array hack needed

rif <[email protected]> Tue, 7 Dec 2004 23:05:53 -0500
Newsgroups gmane.lisp.matlisp.user,gmane.lisp.cmucl.general
Message-ID <[email protected]>
Is there any way, in CMUCL, using some implementation-specific
construct, to create an "aliased array"?  Suppose I create a
double-float array of size 10:

(make-array 10 :element-type 'double-float)

I know I can take it's address, with #'system:vector-sap.

What I want to do is manipulate that address and somehow "invert"
vector-sap to create a new double-float array whose first element is
(for example) the third element of the original array.

I need this because I need to pass matlisp a subset of an array.  More
specifically, I want to allocate an n by n+1 array, so that I can
store half of each of two n by n symmetric arrays in n(n+1) space
rather than 2n^2 space.  This is a common technique for using
BLAS/LAPACK, but to get at it, I need to be able to give a Fortran
matlisp routine a way to get at the square n by n matrix that "starts
with the second column" of the n by n+1 matrix, and the way the
interface is defined, it wants actual arrays, not pointers.  If I can
somehow create the appropriate array, I don't have to go mucking about
in the internals of matlisp's def-fortran-routine and so forth.

(Note that I only need this "aliased array" temporarily, and I'd of
course turn gc off while I needed it.)

Any suggestions or advice are appreciated.  If you respond, please cc
to rif directly --- I think I'm on both these lists, but I'm not 100%
sure.

rif


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/