Circular array in Julia

Note that with this type of approach (as in CircularArrays.jl and CyclicArrays.jl), you pay a computational price for every getindex operations (for a mod in CircularArrays and a much more expensive calculation in CyclicArrays).

In many circumstances, you don’t need to access the array at arbitrary indices, but only at indices in the interior and just outside the boundary, and in such cases you can get both greater efficiency and greater flexibility (in topology etcetera) by using ghost cells.

5 Likes