Subject: RE: [clisp-list] FFI with complex numbers?

From: "Goffioul Michael" <[email-masked]>
Date: Mon May 10 23:53:02 2004

>     Goffioul> Well, yes: a MatLisp version that work with CLISP... :-)
> 
> You could help make that a reality, if it's important to you.  If
> you're interested, subscribe to the matlisp mailing lists on
> sourceforge.net.
> 
> I think there are quite a few people out there who would like such a
> thing.

I'm working on it, but I don't know yet if I'll succeed. I'm in
contact with a MatLisp developer.

>     Goffioul> Writing conversion routines is a possibility, 
> but I fear that efficiency
>     Goffioul> would be low, especially if you want to convert 
> large complex arrays
>     Goffioul> (if you need to do it in a loop). Is there a 
> way to make C code access
>     Goffioul> LISP variables directly (without copying)?
> 
> This is certainly possible since this is what Matlisp does.  However,
> it does require your Lisp to have a specialized array with
> double-float elements that are arranged in one contiguous area, just
> like C or Fortran would.  Given this, you only need a routine that can
> figure the address of this, and Matlisp would work, once the Matlisp
> Fortran FFI is mapped to clisp's FFI.

I don't know(think) that direct memory mapping is possible in CLISP.
It uses copy to send/retrieve data to/from FFI functions.

Michael.

---

From: Raymond Toy <[email-masked]>
Date: Tue May 11 06:48:05 2004

>>>>> "Goffioul" == Goffioul Michael <[email-masked]> writes:

    Goffioul> I'm working on it, but I don't know yet if I'll succeed. I'm in
    Goffioul> contact with a MatLisp developer.

Hmm, there are only two developers, and I pretend to be the other one
sometimes.

    >> Fortran FFI is mapped to clisp's FFI.

    Goffioul> I don't know(think) that direct memory mapping is possible in CLISP.
    Goffioul> It uses copy to send/retrieve data to/from FFI functions.

Just to clarify things, matlisp doesn't pass the array itself,  It
passes the address of the contents of the array to the foreign
function.  Clisp supports passing pointers to foreign functions, I
think.  So what you need is for Clisp to have a specialized array type
for double-float.  

But matlisp doesn't really require that the array be on the Lisp heap.
You could, for example, have the array malloc'ed, or something.
(Matlisp originally did this.)  You would have to decide if this is
really what you want.

But this is getting far from the topic of clisp, so perhaps it should
be taken up elsewhere.

Ray