Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name = "RecursiveArrayTools"
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
version = "3.42.1"
authors = ["Chris Rackauckas <accounts@chrisrackauckas.com>"]
version = "3.42.1"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
Expand Down Expand Up @@ -56,6 +57,7 @@ Measurements = "2.11"
MonteCarloMeasurements = "1.2"
NLsolve = "4.5"
Pkg = "1"
PrecompileTools = "1.2.1"
Random = "1"
RecipesBase = "1.3.4"
ReverseDiff = "1.15"
Expand Down
2 changes: 2 additions & 0 deletions src/RecursiveArrayTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,6 @@ export recursivecopy, recursivecopy!, recursivefill!, vecvecapply, copyat_or_pus

export ArrayPartition, NamedArrayPartition

include("precompilation.jl")

end # module
72 changes: 72 additions & 0 deletions src/precompilation.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using PrecompileTools

@setup_workload begin
@compile_workload begin
# VectorOfArray with Vector{Float64}
u_vec = [rand(3) for _ in 1:5]
va = VectorOfArray(u_vec)

# Basic indexing operations
_ = va[1, 1]
_ = va[:, 1]
_ = va[1, :]
_ = va[:, :]

# Array conversion
_ = Array(va)
_ = Vector(va)

# Broadcasting
va2 = va .+ 1.0
va3 = va .* 2.0
va4 = va .+ va

# copyto!
copyto!(va, va2)

# similar
_ = similar(va)

# DiffEqArray with Vector{Float64}
t = collect(1.0:5.0)
da = DiffEqArray(u_vec, t)

# Basic DiffEqArray operations
_ = da[1, 1]
_ = da[:, 1]
_ = da[1, :]
_ = Array(da)

# ArrayPartition with Float64 vectors
ap = ArrayPartition([1.0, 2.0], [3.0, 4.0, 5.0])

# ArrayPartition operations
_ = ap[1]
_ = length(ap)
_ = Array(ap)

# ArrayPartition broadcasting
ap2 = ap .+ 1.0
ap3 = ap .* 2.0
ap4 = ap .+ ap

# copyto! for ArrayPartition
copyto!(ap, ap2)

# similar for ArrayPartition
_ = similar(ap)

# recursive operations
_ = recursive_mean(ap)
_ = recursivecopy(ap)

# fill!
fill!(similar(va), 0.0)
fill!(similar(ap), 0.0)

# size and ndims
_ = size(va)
_ = ndims(va)
_ = size(ap)
end
end
Loading