Array methods
Indices
PartitionedArrays.linear_indices — Functionlinear_indices(a)Generate an array equal to LinearIndices(a), but whose type and can depend on a. Return LinearIndices(a) by default.
PartitionedArrays.cartesian_indices — Functioncartesian_indices(a)Generate an array equal to CartesianIndices(a), but whose type and can depend on a. Return CartesianIndices(a) by default.
Transformations
PartitionedArrays.MAIN — Constantconst MAIN = 1Constant used to refer the main rank.
PartitionedArrays.i_am_main — FunctionPartitionedArrays.map_main — Functionmap_main(f,args...;kwargs...)Like map(f,args...) but only apply f to one component of the arrays in args.
Optional key-word arguments
main = MAIN: The linear index of the component to mapotherwise = (args...)->nothing: The function to apply when mapping indices different frommain.
Examples
julia> using PartitionedArrays
julia> a = [1,2,3,4]
4-element Vector{Int64}:
1
2
3
4
julia> map_main(-,a,main=2)
4-element Vector{Union{Nothing, Int64}}:
nothing
-2
nothing
nothingPartitionedArrays.tuple_of_arrays — Functiontuple_of_arrays(a)Convert the array of tuples a into a tuple of arrays.
Examples
julia> using PartitionedArrays
julia> a = [(1,2),(3,4),(5,6)]
3-element Vector{Tuple{Int64, Int64}}:
(1, 2)
(3, 4)
(5, 6)
julia> b,c = tuple_of_arrays(a)
([1, 3, 5], [2, 4, 6])PartitionedArrays.array_of_tuples — Functionarray_of_tuples(a)