Re: Comparison of SRFIs 122 and 164
Per Bothner 30 Nov 2019 23:27 UTC
On 11/30/19 2:06 PM, John Cowan wrote:
> 3) SRFI 122 specifies how the user can create storage objects that are restricted to contain only particular values such as bytes or 64-bit floats. SRFI 164 leaves that up to the implementation.
Well, SRFI 164 does integrate with SRFI 4 (or 160), assuming you allow uniform vectors as "gectors".
To allocate an f32 N*M matrix, one can do:
(array-reshape (make-f32vector (* N M)) (vector N M))
> 6) SRFI 122's transformation procedures are affine, which means they are very efficient. SRFI 164 provides general transformations, which can of course be written on top of SRFI 122, but aren't provided by default.
SRFI 164 includes share-array from SRFI 25, which which requires an affine transformation function.
array-index-share will create an efficient affine transformation when each index is an integer or a range.
In both cases, the implementation is optimized to take advantage of the affine mapping
(using the somewhat misnamed class GeneralArray).
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/