array-stack should use the specified storage-class

The original code was based on (chibi math linalg)
which preferred the domain of the stacked arrays.
This commit is contained in:
Alex Shinn 2024-05-27 18:33:24 +09:00
parent 07f3301cc8
commit a8939fecd0
2 changed files with 24 additions and 4 deletions

View file

@ -3277,6 +3277,29 @@
(array->list*
(array-stack 0 (list (list*->array 2 '((4 7) (2 6)))
(list*->array 2 '((1 0) (0 1)))))))
(test-error
(array-stack 0
(list (make-array (make-interval '#(2 2)) list)
(make-array (make-interval '#(2 2)) list))
'a))
(test-error
(array-stack 0
(list (make-array (make-interval '#(2 2)) list) (make-array (make-interval '#(2 2)) list))
u1-storage-class
'a))
(test-error
(array-stack 0
(list (make-array (make-interval '#(2 2)) list) (make-array (make-interval '#(2 2)) list))
u1-storage-class))
(test
generic-storage-class
(array-storage-class
(array-stack
1
(list (array-copy (make-array (make-interval '#(10)) (lambda (i) 42))
u8-storage-class)
(array-copy (make-array (make-interval '#(10)) (lambda (i) 5000))
u16-storage-class)))))
(test '((0 1 4 6 7 8)
(2 3 5 9 10 11)
(12 13 14 15 16 17))

View file

@ -683,10 +683,7 @@
(make-interval
`#(,@(take a-lbs axis) 0 ,@(drop a-lbs axis))
`#(,@(take a-ubs axis) ,(length arrays) ,@(drop a-ubs axis))))
(res (make-specialized-array/default domain
(or (array-storage-class a)
generic-storage-class)
safe?))
(res (make-specialized-array/default domain storage safe?))
;; Stack by permuting the desired axis to the first
;; dimension and currying on that, assigning the
;; corresponding array argument to each element.