guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] array slice functions


From: Daniel Llorens
Subject: [patch] array slice functions
Date: Wed, 11 Feb 2015 20:25:06 +0100

Hello,

The patches I've just pushed lloda-array-support (ending in 
http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commitdiff;h=64fa67c2f0e08e42a60921db4aa77fa3e52d3fa6)
 implement the functions (array-from) and (array-amend!), to take or modify 
array prefix slices. The patches include documentation and tests.

I'd like a version of these patches to be merged before 2.2 is released.

These functions do not cover all the cases of multidimensional array 
subscripting that one may find in other languages, such as Fortran or APL. They 
are only a foundation. The general subscripting operator implemented in 
https://gitorious.org/guile-ploy (with the names from / set-from!) is built on 
top of array-from / array-amend!.

I have chosen these particular forms because the implementation is especially 
simple, nearly identical to that of array-ref. The replacement of 
make-shared-array pays off in terms of speed. For example, the tests of 
guile-ploy run in 2.1s with the versions of array-from and array-amend! 
included in these patches, but take 3.5s if array-from and array-amend! are 
implemented on top of make-shared-array.

Guile/Scheme is still missing an efficient way to iterate over array slices. 
Logically this should only require bumping a pointer on each iteration. But 
with the limited array primitives provided by Guile, one must create a shared 
view on each iteration and manage the loop separately.

I think that eventually it will be necessary to expose the array strides and 
dimensions in Scheme. It may take some effort to do this without making access 
from C more difficult than it already is. 

Regards,

        Daniel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]