[Gsll-devel] Extracting sub-matrices and sub-vectors?

Malcolm Reynolds malcolm.reynolds at gmail.com
Wed Apr 29 18:16:04 UTC 2009


Hi guys,

I've been out of the country for a while but I'm getting back to work
on my project. Something else I've been wondering about for GSLL is
whether there is a way to quickly extract sub-matrices and especially
sub-vectors from a matrix. Something with power equivalent to the
matlab indexing using a colon to express ranges would be amazing but I
guess probably quite nasty to implement efficiently. However, what
would help me even more right now is a way to extract rows / columns
from a matrix, without copying. I currently use a do-loop to run
through the indices I want, but since the internals of the storage
appear to be row major, is there a way to get a "pointer" (not sure if
this is preferred lisp terminology, sorry) to an individual row?

To clarify, if I do

(defvar x (make-marray 'double-float :initial-contents '((1 2 3) (4 5
6) (7 8 9))))

is there any efficient way (ie don't need to copy element by element
to a new object) thatI can get a reference to the row (4 5 6) of that,
either as a gsll::matrix or gsll::vector object? If structure was
shared between the matrix and the vector that would be no problem, it
would be ideal in fact.

Regards

Malcolm

Malcolm




More information about the gsll-devel mailing list