Array methods

Indices

Transformations

PartitionedArrays.map_mainFunction
map_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 map
  • otherwise = (args...)->nothing: The function to apply when mapping indices different from main.

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
   nothing
source
PartitionedArrays.tuple_of_arraysFunction
tuple_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])
source