matlisp-users

 Re: [Matlisp-users] help with gross array hack needed From: rif - 2004-12-08 15:41:33 ```> 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. ```
 Re: [Matlisp-users] help with gross array hack needed From: Raymond Toy - 2004-12-08 16:24:34 ```>>>>> "rif" == rif writes: rif> Alternately, within matlisp, is there an easy way to extend (for rif> example) vector-data-address to work on a (simple-array double-float rif> *) in the right way? Right now, it fails on the check-type, because rif> it requires a simple-array. Yes, it can be extended. Sufficient uses of array-displacement and (typep foo 'simple-array) should allow you to track down the real simple-array so vector-data-address will work. But this no longer has anything to do with cmucl, so perhaps the matlisp mailing list is the right place to talk about this? Ray ```