mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 20:05:32 +02:00
Rewrite scm_ramapc()
* libguile/array-map.c - (cind): replace by cindk, that operates only on the unrolled index set. - (klen): new function. - (make1array): take extra inc argument. - (scm_ramapc): rewrite to unroll as many axes as possible instead of just all or one. - (AREF): lbnd is known to be 0: remove. - (ASET): v is known to come from SCM_I_ARRAY_V; assume base, inc, lbnd. - (racp): use ssize_t instead of long for the indices. - (scm_array_index_map_x): build the index list at the last-but-one axis, then set the car of the last element, instead of building the list at the last axis. * test-suite/tests/ramap.test - add array-map! test with offset arguments.
This commit is contained in:
parent
2a8688a9d1
commit
4cde4f63ee
2 changed files with 134 additions and 124 deletions
|
@ -316,7 +316,14 @@
|
|||
(c (make-array 0 2)))
|
||||
(begin
|
||||
(array-map! c + (array-col a 1) (array-row a 1))
|
||||
(array-equal? c #(3 6))))))
|
||||
(array-equal? c #(3 6)))))
|
||||
|
||||
(pass-if "offset arrays 1"
|
||||
(let ((a #2@1@-3((0 1) (2 3)))
|
||||
(c (make-array 0 '(1 2) '(-3 -2))))
|
||||
(begin
|
||||
(array-map! c + a a)
|
||||
(array-equal? c #2@1@-3((0 2) (4 6)))))))
|
||||
|
||||
;; note that array-copy! has the opposite behavior.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue