> Not necessarily. Displaced arrays are good for row-major slices. So
> if the matrix where (N + 1 x N), then you could "displace away" the
> first row. Unfortunately, FORTRAN is column-major. The only way I see
> around this is to transpose the array first, and then displace.
> However, that may cause problems for the algorithm at hand.
>
> Isn't this fun? :)
> Marco Antoniotti http://bioinformatics.nyu.edu
Actually, I'm OK with row-major vs. column-major, because all my
matlisp arrays are stored as 1d column-major arrays in CL.
The real problem with displacement is that displacing a (simple-array
double-float *) produces a (vector double-float *), and therefore I
cannot write something like:
(defmethod displaced-matrix ((m real-matrix) (start-column fixnum))
(let* ((nc (number-of-cols m))
(nr (number-of-rows m))
(new-columns (- nc start-column)))
(make-instance 'real-matrix
:nrows nr
:ncols (- nc start-column)
:store (make-array (* nr new-columns)
:element-type 'double-float
:displaced-to (matlisp::store m)
:displaced-index-offset (* nr start-column)))))
Is there any (obviously, implementation specific way) to do a
displaced (simple-array double-float *) --- this was my original
question?
Alternately, within matlisp, is there an easy way to extend (for
example) vector-data-address to work on a (simple-array double-float
*) in the right way? Right now, it fails on the check-type, because
it requires a simple-array.
Cheers,
rif
ps. Obviously, I can do what I want with sufficient effort. For
instance, I could define my own interface to the Fortran functions
which take pointers directly, and then do the pointer arithmetic
myself. This seems like a lot of work, and I'm attempting to avoid
this, though I may have to do it if there's no other way.
|