From: Raymond T. <ray...@er...> - 2005-12-07 14:14:44
|
>>>>> "AJ" == A J Rossini <A.J.> writes: AJ> (of course, I'm also shooting for general world domination, as well, AJ> which means including as much as possible in a single, cross-CL, AJ> package that I can use for facilitating LispStat, based on CommonLisp AJ> (across implementations), as a superior replacement for R). You do know, of course, that Matlisp only works with cmucl, sbcl, and allegro. No one has bothered to write the appropriate Fortran FFI macros for other systems. Perhaps using CFFI instead of our homegrown Fortran FFI would be useful here. Although I'm reluctant to add yet another external dependency, it could simplify some things quite a bit. Ray |
From: A.J. R. <bli...@gm...> - 2005-12-07 14:44:15
|
T24gMTIvNy8wNSwgUmF5bW9uZCBUb3kgPHJheW1vbmQudG95QGVyaWNzc29uLmNvbT4gd3JvdGU6 Cj4gPj4+Pj4gIkFKIiA9PSBBIEogUm9zc2luaSA8QS5KLj4gd3JpdGVzOgo+Cj4gICAgIEFKPiAo b2YgY291cnNlLCBJJ20gYWxzbyBzaG9vdGluZyBmb3IgZ2VuZXJhbCB3b3JsZCBkb21pbmF0aW9u LCBhcyB3ZWxsLAo+ICAgICBBSj4gd2hpY2ggbWVhbnMgaW5jbHVkaW5nIGFzIG11Y2ggYXMgcG9z c2libGUgaW4gYSBzaW5nbGUsIGNyb3NzLUNMLAo+ICAgICBBSj4gcGFja2FnZSB0aGF0IEkgY2Fu IHVzZSBmb3IgZmFjaWxpdGF0aW5nIExpc3BTdGF0LCBiYXNlZCBvbiBDb21tb25MaXNwCj4gICAg IEFKPiAoYWNyb3NzIGltcGxlbWVudGF0aW9ucyksIGFzIGEgc3VwZXJpb3IgcmVwbGFjZW1lbnQg Zm9yIFIpLgo+Cj4gWW91IGRvIGtub3csIG9mIGNvdXJzZSwgdGhhdCBNYXRsaXNwIG9ubHkgd29y a3Mgd2l0aCBjbXVjbCwgc2JjbCwgYW5kCj4gYWxsZWdyby4gIE5vIG9uZSBoYXMgYm90aGVyZWQg dG8gd3JpdGUgdGhlIGFwcHJvcHJpYXRlIEZvcnRyYW4gRkZJCj4gbWFjcm9zIGZvciBvdGhlciBz eXN0ZW1zLiAgUGVyaGFwcyB1c2luZyBDRkZJIGluc3RlYWQgb2Ygb3VyIGhvbWVncm93bgo+IEZv cnRyYW4gRkZJIHdvdWxkIGJlIHVzZWZ1bCBoZXJlLiAgQWx0aG91Z2ggSSdtIHJlbHVjdGFudCB0 byBhZGQgeWV0Cj4gYW5vdGhlciBleHRlcm5hbCBkZXBlbmRlbmN5LCBpdCBjb3VsZCBzaW1wbGlm eSBzb21lIHRoaW5ncyBxdWl0ZSBhCj4gYml0LgoKSSdtIFZFUlkgd2VsbCBhd2FyZSBvZiBpdC4g IEJ1dCAzIGlzIGEgZ29vZCBzdGFydCwgYW5kIENGRkkgZ2V0cwpiZXR0ZXIgYW5kIGJldHRlci4u LgoKYmVzdCwKLXRvbnkKCmJsaW5kZ2xvYmVAZ21haWwuY29tCk11dHRlbnosIFN3aXR6ZXJsYW5k LgoiQ29tbWl0IGVhcmx5LGNvbW1pdCBvZnRlbiwgYW5kIGNvbW1pdCBpbiBhIHJlcG9zaXRvcnkg ZnJvbSB3aGljaCB3ZSBjYW4gZWFzaWx5CnJvbGwtYmFjayB5b3VyIG1pc3Rha2VzIiAoQUpSLCA0 SmFuMDUpLgo= |
From: Jan R. <ja...@ry...> - 2005-12-14 20:00:57
|
>>>>> "Nicolas" == Nicolas Neuss <Nic...@iw...> writes: Nicolas> Jan Rychter <ja...@ry...> writes: [...] >> As it is, I'll probably reinvent the wheel and write my own >> functions using DCOPY, as you suggested. Nicolas> I'm quite sure this is the choice fitting the Matlisp way Nicolas> best. If you indeed want to make it into a generic function, Nicolas> it would be nice if you could use my MEXTRACT/MINJECT syntax. Nicolas> Probably, the Matlisp authors would also welcome such a Nicolas> contribution. Well, the discussion seems to have died, so I thought I'd contribute what I use now. It is much faster than my previous macros. Only works for real matrices for now. I didn't use DCOPY, because I don't know how to dereference a particular element in the matrix store, instead of the store itself (C pointers, anyone?). DCOPY would undoubtedly be much faster, especially for larger matrices. Nicolas -- sorry, I didn't use your syntax. I felt it isn't really compatible with matlisp and I really wanted to do things like (setf (column-ref m i) some-vector) --J. (defmethod column-ref ((matrix real-matrix) column) (let* ((n (nrows matrix)) (result (make-real-matrix-dim n 1)) (src-store (matlisp::store matrix)) (dst-store (matlisp::store result))) (declare (type fixnum n) (type (real-matrix-store-type (*)) src-store dst-store)) (dotimes (i n) (declare (type fixnum i)) (setf (aref dst-store i) (aref src-store (fortran-matrix-indexing i column n)))) result)) (defmethod (setf column-ref) (value (matrix real-matrix) column) (let* ((n (nrows matrix)) (src-store (matlisp::store value)) (dst-store (matlisp::store matrix))) (declare (type fixnum n) (type (real-matrix-store-type (*)) src-store dst-store)) (dotimes (i n) (declare (type fixnum i)) (setf (aref dst-store (fortran-matrix-indexing i column n)) (aref src-store i))) matrix)) (defmethod row-ref ((matrix real-matrix) row) (let* ((n (nrows matrix)) (m (ncols matrix)) (result (make-real-matrix-dim 1 m)) (src-store (matlisp::store matrix)) (dst-store (matlisp::store result))) (declare (type fixnum n m) (type (real-matrix-store-type (*)) src-store dst-store)) (dotimes (i m) (declare (type fixnum i)) (setf (aref dst-store (fortran-matrix-indexing 0 i 1)) (aref src-store (fortran-matrix-indexing row i n)))) result)) (defmethod (setf row-ref) (value (matrix real-matrix) row) (let* ((n (nrows matrix)) (m (ncols matrix)) (src-store (matlisp::store value)) (dst-store (matlisp::store matrix))) (declare (type fixnum n m) (type (real-matrix-store-type (*)) src-store dst-store)) (dotimes (i m) (declare (type fixnum i)) (setf (aref dst-store (fortran-matrix-indexing row i n)) (aref src-store (fortran-matrix-indexing 0 i 1)))) matrix)) (defmethod row-ref-transposed ((matrix real-matrix) row) (let* ((n (nrows matrix)) (m (ncols matrix)) (result (make-real-matrix-dim m 1)) (src-store (matlisp::store matrix)) (dst-store (matlisp::store result))) (declare (type fixnum n m) (type (real-matrix-store-type (*)) src-store dst-store)) (dotimes (i m) (declare (type fixnum i)) (setf (aref dst-store i) (aref src-store (fortran-matrix-indexing row i n)))) result)) |