Skip to content

gatocor/RecursiveArrayTools.jl

 
 

Repository files navigation

RecursiveArrayTools.jl

Join the chat at https://julialang.zulipchat.com #sciml-bridged Global Docs

codecov Build Status build status

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages SciML Code Style

RecursiveArrayTools.jl is a set of tools for dealing with recursive arrays like arrays of arrays.

Tutorials and Documentation

For information on using the package, see the stable documentation. Use the in-development documentation for the version of the documentation, which contains the unreleased features.

Example

VectorOfArray

using RecursiveArrayTools
a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
b = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
vA = VectorOfArray(a)
vB = VectorOfArray(b)

vA .* vB # Now all standard array stuff works!

ArrayPartition

a = (rand(5), rand(5))
b = (rand(5), rand(5))
pA = ArrayPartition(a)
pB = ArrayPartition(b)

pA .* pB # Now all standard array stuff works!

# or do:
x0 = rand(3, 3)
v0 = rand(3, 3)
a0 = rand(3, 3)
u0 = ArrayPartition(x0, v0, a0)
u0.x[1] == x0 # true

u0 .+= 1
u0.x[2] == v0 # still true

# do some calculations creating a new partitioned array
unew = u0 * 10
# easily access the individual components without having to rely on complicated indexing
xnew, vnew, anew = unew.x

About

Tools for easily handling objects like arrays of arrays and deeper nestings in scientific machine learning (SciML) and other applications

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Julia 100.0%