Stopped exporting `slice-indexes-array'
This commit is contained in:
parent
897ebeae83
commit
6ca52be0ae
|
@ -5,8 +5,7 @@
|
|||
array-ref
|
||||
array-set!
|
||||
array-indexes-ref
|
||||
array-indexes-set!
|
||||
slice-indexes-array))
|
||||
array-indexes-set!))
|
||||
|
||||
(require/untyped-contract
|
||||
(begin (require "array-struct.rkt"
|
||||
|
@ -16,8 +15,7 @@
|
|||
[array-ref (All (A) ((Array A) (Vectorof Integer) -> A))]
|
||||
[array-set! (All (A) ((Settable-Array A) (Vectorof Integer) A -> Void))]
|
||||
[array-indexes-ref (All (A) ((Array A) (Array (Vectorof Integer)) -> (Array A)))]
|
||||
[array-indexes-set! (All (A) ((Settable-Array A) (Array (Vectorof Integer)) (Array A) -> Void))]
|
||||
[slice-indexes-array ((Vectorof Integer) (Listof Slice-Spec) -> (Array Indexes))])
|
||||
[array-indexes-set! (All (A) ((Settable-Array A) (Array (Vectorof Integer)) (Array A) -> Void))])
|
||||
|
||||
(provide
|
||||
array-ref
|
||||
|
@ -36,5 +34,4 @@
|
|||
::... slice-dots?
|
||||
::new slice-new-axis? slice-new-axis-length
|
||||
array-slice-ref
|
||||
slice-indexes-array
|
||||
array-slice-set!)
|
||||
|
|
|
@ -237,13 +237,10 @@
|
|||
(match-define (cons k dk) na)
|
||||
(array-axis-insert arr k dk)))))
|
||||
|
||||
(: slice-indexes-array (In-Indexes (Listof Slice-Spec) -> (Array Indexes)))
|
||||
(define (slice-indexes-array ds slices)
|
||||
(array-slice-ref (indexes-array ds) slices))
|
||||
|
||||
(: array-slice-set! (All (A) ((Settable-Array A) (Listof Slice-Spec) (Array A) -> Void)))
|
||||
(define (array-slice-set! arr slices vals)
|
||||
(array-indexes-set! arr (slice-indexes-array (array-shape arr) slices) vals))
|
||||
(let ([idxs (array-slice-ref (indexes-array (array-shape arr)) slices)])
|
||||
(array-indexes-set! arr idxs vals)))
|
||||
|
||||
;; ---------------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1042,7 +1042,8 @@ If @racket[idxs] and @racket[vals] do not have the same shape, they are @tech{br
|
|||
(define idxs (array #['#(0 0) '#(1 1)]))
|
||||
(array-indexes-set! arr idxs (array -1))
|
||||
arr]
|
||||
When indexes are repeated in @racket[idxs], they are mutated in some unspecified order.
|
||||
When two indexes in @racket[idxs] are the same, the element at that index is mutated more
|
||||
than once in some unspecified order.
|
||||
}
|
||||
|
||||
@defproc[(array-slice-ref [arr (Array A)] [specs (Listof Slice-Spec)]) (Array A)]{
|
||||
|
@ -1053,18 +1054,12 @@ Returns a transformation of @racket[arr] according to the list of slice specific
|
|||
@defproc[(array-slice-set! [arr (Settable-Array A)] [specs (Listof Slice-Spec)] [vals (Array A)])
|
||||
Void]{
|
||||
Like @racket[array-indexes-set!], but for slice specifications. Equivalent to
|
||||
@racketblock[(let ([idxs (slice-indexes-array (array-shape arr) specs)])
|
||||
@racketblock[(let ([idxs (array-slice-ref (indexes-array (array-shape arr)) specs)])
|
||||
(array-indexes-set! arr idxs vals))]
|
||||
When a slice specification refers to an element in @racket[arr] more than once, the element is
|
||||
mutated more than once in some unspecified order.
|
||||
}
|
||||
|
||||
@defproc[(slice-indexes-array [ds In-Indexes] [specs (Listof Slice-Spec)]) (Array Indexes)]{
|
||||
Returns the indexes of the elements that would be retrieved if an array with shape @racket[ds]
|
||||
were sliced according to @racket[specs].
|
||||
Equivalent to @racketblock[(array-slice-ref (indexes-array ds) specs)]
|
||||
}
|
||||
|
||||
@subsection[#:tag "array:slice-specs"]{Slice Specifications}
|
||||
|
||||
@defidform[Slice-Spec]{
|
||||
|
|
|
@ -613,7 +613,7 @@
|
|||
[slices (list (:: 0 4 2) (:: 2 -1 -2))])
|
||||
(check-equal? (array-indexes-ref arr idxs)
|
||||
(array #[0 2 3 5 7 8]))
|
||||
(check-equal? (array-indexes-ref arr (slice-indexes-array (array-shape arr) slices))
|
||||
(check-equal? (array-indexes-ref arr (array-slice-ref (indexes-array (array-shape arr)) slices))
|
||||
(array-slice-ref arr slices))
|
||||
(array-indexes-set! arr idxs vals)
|
||||
(check-equal? arr (array #[#['a 1 2 3 4 5]
|
||||
|
|
Loading…
Reference in New Issue
Block a user