array-{append|stack|inner-product}
Bradley Lucier 21 Oct 2021 15:52 UTC
On 9/24/21 3:24 PM, John Cowan wrote:
> 3) (array-append k a1 a2 ...) concatenates its array arguments along the
> kth dimension. The arrays must have the same number of dimensions and
> all but the kth dimension must be equal. The result has an interval
> where each dimension except k is copied from the input arrays and the
> kth dimension is the sum of the kth dimensions of the input arrays
> adjusted to a lower bound of 0. So given a 3 x 3 array and a 3 x 4
> array, these can be concatenated along the column dimension giving a 3 x
> 7 array, but it is an error to concatenate them along the row dimension.
>
> 4) (array-laminate k a1 a2 ...) creates a new dimension between k = 1
> and k (a new first dimension if k = -1). The arrays must have the same
> interval. The new dimension's upper bound is the number of array
> arguments, and each array argument is used to fill one of the elements
> of the dimension. Thus laminating two 3 x 3 arrays gives 2 x 3 x 3, 3 x
> 2 x 3, or 3 x 3 x 2 results depending on k = -1, 0, 1.
>
> 5) Put inner product into the spec rather than the examples. It is an
> error if both array arguments are one-dimensional. (Avoiding this wart
> is the reason for supporting 0-dimensional arrays in CL, I think.)
I've specified, coded, documented, and tested these routines at
https://github.com/gambiteer/srfi-179-followup/
I'd be happier if there were more varied tests of array-{append|stack},
but for now it's OK.
I left the default safety and mutability as parameters, and added them
as optional arguments to array-{stack|append}.
I think I've addressed all comments in this thread and all comments that
came up previously.
I don't want to have a fourth version of this SRFI, so I'm going to let
things sit for a bit before submitting this followup to SRFI 179.
Brad