[Gsll-devel] GSLL utility development
Malcolm Reynolds
malcolm.reynolds at gmail.com
Mon Oct 19 21:28:57 UTC 2009
For those interested in this, I've just added slices which can be both
read and written to. IMO This gets us a long way towards feature
parity with matlab. Code is in the github branch, specifically this
file:
http://github.com/malcolmreynolds/GSLL/blob/malcolm-utils/utils/slice.lisp
.. all code should be considered heavily alpha, and I'll probably
tweak it quite a lot in the near future.
For those who don't know what I'm talking about, you can now read and
write arbitrary bits of a matrix like this:
GSLU> m
#<MATRIX-DOUBLE-FLOAT #2A((1.0d0 2.0d0 3.0d0 4.0d0)
(5.0d0 6.0d0 7.0d0 8.0d0)
(9.0d0 10.0d0 11.0d0 12.0d0))>
GSLU> (mslice m :all '(3 1 2 0))
#<MATRIX-DOUBLE-FLOAT #2A((4.0d0 2.0d0 3.0d0 1.0d0)
(8.0d0 6.0d0 7.0d0 5.0d0)
(12.0d0 10.0d0 11.0d0 9.0d0))>
GSLU> (mslice m '(0 2) '(3 0))
#<MATRIX-DOUBLE-FLOAT #2A((4.0d0 1.0d0) (12.0d0 9.0d0))>
GSLU> (setf (mslice m '(0 2) '(1 3)) #m(101 102 ^ 103 104))
#<MATRIX-DOUBLE-FLOAT #2A((1.0d0 101.0d0 3.0d0 102.0d0)
(5.0d0 6.0d0 7.0d0 8.0d0)
(9.0d0 103.0d0 11.0d0 104.0d0))>
Any bug reports or comments gratefully received...
Malcolm
More information about the gsll-devel
mailing list