[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guile-user Digest, Vol 194, Issue 29
From: |
Daniel Llorens |
Subject: |
Re: guile-user Digest, Vol 194, Issue 29 |
Date: |
Mon, 28 Jan 2019 18:46:20 +0100 |
> On 28 Jan 2019, at 18:00, address@hidden wrote:
> From: Matt Wette <address@hidden>
> Subject: Re: Matrix or array operations library
> Date: 27 January 2019 at 19:41:57 CET
> To: address@hidden <mailto:address@hidden>
> …
> Also, is it possible to get a pointer to the first element of an array
> (i.e., it's #f64() root vector), for the purpose of using with FFI?
Yes, you'd do
(bytevector->pointer (shared-array-root ARRAY) (* (shared-array-offset ARRAY)
(sizeof TYPE)))
you can get the type with (array-type ARRAY), only that returns a symbol that
has to be translated to the values that sizeof accepts (int double float etc),
those are in (system foreign). Maybe it would be a good idea to have sizeof
accept 'f32 'f64 etc directly.
Here's an full example for FFTW.
https://github.com/lloda/guile-ffi-fftw/blob/master/mod/ffi/fftw.scm
<https://github.com/lloda/guile-ffi-fftw/blob/master/mod/ffi/fftw.scm>
Regards
Daniel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: guile-user Digest, Vol 194, Issue 29,
Daniel Llorens <=