> From: Matt Wette <[email protected]> > Subject: Re: Matrix or array operations library > Date: 29 December 2018 at 00:24:38 CET > To: [email protected] > > > On 12/28/18 12:23 PM, Daniel Llorens wrote: >> >> John already wrote a nice explanation of how array strides work. You mean >> specifically for Guile? >> >> > Yes, for Guile. I understand strides and offsets. I think the functionality > is basically there > with shared-arrays. So I take back that Guile does not have this. I will > play later. > > For example, interesting check will be if one can make a shared-1D array from > the diagonal elements > of a 2D square array (i.e., ((1 2 3) (4 5 6) (7 8 9)) => (1 5 9).
sure, I think that specific example is even in the manual. Yes, the 3rd example here https://www.gnu.org/software/guile/manual/html_node/Shared-Arrays.html#index-make_002dshared_002darray (transpose-array #2((1 2 3) (4 5 6) (7 8 9)) 0 0) also works; I've seen this idiom used in APL (say (0 0)⍉A). > And the transpose I see as a utility that I guess just calls > make-shared-array. I think transpose-array happens to have a C implementation (although it could certainly be done using make-shared-array). Daniel
