Skip to content

Commit

Permalink
array-stack should use the specified storage-class
Browse files Browse the repository at this point in the history
The original code was based on (chibi math linalg)
which preferred the domain of the stacked arrays.
  • Loading branch information
ashinn committed May 27, 2024
1 parent 07f3301 commit a8939fe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
23 changes: 23 additions & 0 deletions lib/srfi/231/test.sld
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
5 changes: 1 addition & 4 deletions lib/srfi/231/transforms.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a8939fe

Please sign in to comment.