From f218351efd3b9c7b001c78f65b5d9e0b6b39fa99 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Tue, 9 Aug 2016 17:48:08 -0500 Subject: [PATCH] Export circcopy! and add it to the RST manual --- base/exports.jl | 1 + doc/stdlib/arrays.rst | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/base/exports.jl b/base/exports.jl index 33fe8c6850852..da164c187ed9a 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -489,6 +489,7 @@ export cat, checkbounds, checkindex, + circcopy!, circshift, circshift!, clamp!, diff --git a/doc/stdlib/arrays.rst b/doc/stdlib/arrays.rst index 669b08626b7ee..4fc6612761c2f 100644 --- a/doc/stdlib/arrays.rst +++ b/doc/stdlib/arrays.rst @@ -647,6 +647,33 @@ Indexing, Assignment, and Concatenation See also ``circshift``\ . +.. function:: circcopy!(dest, src) + + .. Docstring generated from Julia source + + Copy ``src`` to ``dest``\ , indexing each dimension modulo its length. ``src`` and ``dest`` must have the same size, but can be offset in their indices; any offset results in a (circular) wraparound. If the arrays have overlapping indices, then on the domain of the overlap ``dest`` agrees with ``src``\ . + + .. code-block:: julia + + julia> src = reshape(collect(1:16), (4,4)) + 4×4 Array{Int64,2}: + 1 5 9 13 + 2 6 10 14 + 3 7 11 15 + 4 8 12 16 + + julia> dest = OffsetArray{Int}((0:3,2:5)) + + julia> circcopy!(dest, src) + OffsetArrays.OffsetArray{Int64,2,Array{Int64,2}} with indices 0:3×2:5: + 8 12 16 4 + 5 9 13 1 + 6 10 14 2 + 7 11 15 3 + + julia> dest[1:3,2:4] == src[1:3,2:4] + true + .. function:: find(A) .. Docstring generated from Julia source