Email list hosting service & mailing list manager

specialized-array-reshape Bradley Lucier (06 May 2020 15:40 UTC)
Re: specialized-array-reshape John Cowan (06 May 2020 16:16 UTC)
Re: specialized-array-reshape Jeffrey Mark Siskind (06 May 2020 16:24 UTC)
Re: specialized-array-reshape Bradley Lucier (06 May 2020 19:24 UTC)
Re: specialized-array-reshape John Cowan (06 May 2020 19:27 UTC)

Re: specialized-array-reshape Bradley Lucier 06 May 2020 19:24 UTC

Thank you both for your comments.

Here's what I think I might do:

1.  Change

(define (array->specialized-array array
                                   #!optional
                                   (result-storage-class
generic-storage-class)
                                   (mutable?
(specialized-array-default-mutable?))
                                   (safe?
(specialized-array-default-safe?)))

to

(define (array-copy array
                     #!optional
                     (result-storage-class generic-storage-class)
                     (reshape? #f)
                     (mutable? (specialized-array-default-mutable?))
                     (safe? (specialized-array-default-safe?)))

where the optional reshape? argument can be #f (meaning the new
specialized array result has the same domain as the first argument) or a
new interval that has the same volume as the domain of the first
argument (which will be the domain of the specialized array result).

I think the optional arguments are ordered from most likely to least
likely to be used.

So this copying operation can reshape any array to one of the same volume.

2.  Define

(define (specialized-array-reshape array new-domain)
   ...

that will succeed only if one can guarantee that the new array has an
affine indexer.  If we can't, the error message will suggest making a
new array with array-copy.

I like it.

Comments?

Brad