mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
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:
parent
07f3301cc8
commit
a8939fecd0
2 changed files with 24 additions and 4 deletions
|
@ -3277,6 +3277,29 @@
|
||||||
(array->list*
|
(array->list*
|
||||||
(array-stack 0 (list (list*->array 2 '((4 7) (2 6)))
|
(array-stack 0 (list (list*->array 2 '((4 7) (2 6)))
|
||||||
(list*->array 2 '((1 0) (0 1)))))))
|
(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)
|
(test '((0 1 4 6 7 8)
|
||||||
(2 3 5 9 10 11)
|
(2 3 5 9 10 11)
|
||||||
(12 13 14 15 16 17))
|
(12 13 14 15 16 17))
|
||||||
|
|
|
@ -683,10 +683,7 @@
|
||||||
(make-interval
|
(make-interval
|
||||||
`#(,@(take a-lbs axis) 0 ,@(drop a-lbs axis))
|
`#(,@(take a-lbs axis) 0 ,@(drop a-lbs axis))
|
||||||
`#(,@(take a-ubs axis) ,(length arrays) ,@(drop a-ubs axis))))
|
`#(,@(take a-ubs axis) ,(length arrays) ,@(drop a-ubs axis))))
|
||||||
(res (make-specialized-array/default domain
|
(res (make-specialized-array/default domain storage safe?))
|
||||||
(or (array-storage-class a)
|
|
||||||
generic-storage-class)
|
|
||||||
safe?))
|
|
||||||
;; Stack by permuting the desired axis to the first
|
;; Stack by permuting the desired axis to the first
|
||||||
;; dimension and currying on that, assigning the
|
;; dimension and currying on that, assigning the
|
||||||
;; corresponding array argument to each element.
|
;; corresponding array argument to each element.
|
||||||
|
|
Loading…
Add table
Reference in a new issue