Skip to content

Commit b48db35

Browse files
Merge pull request #210 from SciML/docs
Build a proper documentation
2 parents a0ddeb5 + edb3858 commit b48db35

File tree

12 files changed

+256
-125
lines changed

12 files changed

+256
-125
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'release-'
8+
tags: '*'
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: julia-actions/setup-julia@latest
17+
with:
18+
version: '1'
19+
- name: Install dependencies
20+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
21+
- name: Build and deploy
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
24+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
25+
run: julia --project=docs/ docs/make.jl

README.md

Lines changed: 1 addition & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -5,128 +5,4 @@
55
[![Build status](https://badge.buildkite.com/5f39777d009ce94ef1dcf2a4881c68b9fbcaf6f69f1d8b8df2.svg)](https://buildkite.com/julialang/recursivearraytools-dot-jl)
66

77
RecursiveArrayTools.jl is a set of tools for dealing with recursive arrays like
8-
arrays of arrays. The current functionality includes:
9-
10-
### Types
11-
12-
#### VectorOfArray
13-
14-
```julia
15-
VectorOfArray(u::AbstractVector)
16-
```
17-
18-
A `VectorOfArray` is an array which has the underlying data structure `Vector{AbstractArray{T}}`
19-
(but, hopefully, concretely typed!). This wrapper over such data structures allows one to lazily
20-
act like it's a higher-dimensional vector, and easily convert to different forms. The indexing
21-
structure is:
22-
23-
```julia
24-
A[i] # Returns the ith array in the vector of arrays
25-
A[j,i] # Returns the jth component in the ith array
26-
A[j1,...,jN,i] # Returns the (j1,...,jN) component of the ith array
27-
```
28-
29-
which presents itself as a column-major matrix with the columns being the arrays from the vector.
30-
The `AbstractArray` interface is implemented, giving access to `copy`, `push`, `append!`, etc. functions,
31-
which act appropriately. Points to note are:
32-
33-
- The length is the number of vectors, or `length(A.u)` where `u` is the vector of arrays.
34-
- Iteration follows the linear index and goes over the vectors
35-
36-
Additionally, the `convert(Array,VA::AbstractVectorOfArray)` function is provided, which transforms
37-
the `VectorOfArray` into a matrix/tensor. Also, `vecarr_to_vectors(VA::AbstractVectorOfArray)`
38-
returns a vector of the series for each component, that is, `A[i,:]` for each `i`.
39-
A plot recipe is provided, which plots the `A[i,:]` series.
40-
41-
#### DiffEqArray
42-
43-
Related to the `VectorOfArray` is the `DiffEqArray`
44-
45-
```julia
46-
DiffEqArray(u::AbstractVector,t::AbstractVector)
47-
```
48-
49-
This is a `VectorOfArray`, which stores `A.t` that matches `A.u`. This will plot
50-
`(A.t[i],A[i,:])`. The function `tuples(diffeq_arr)` returns tuples of `(t,u)`.
51-
52-
To construct a DiffEqArray
53-
```julia
54-
t = 0.0:0.1:10.0
55-
f(t) = t - 1
56-
f2(t) = t^2
57-
vals = [[f(tval) f2(tval)] for tval in t]
58-
A = DiffEqArray(vals, t)
59-
A[1,:] # all time periods for f(t)
60-
A.t
61-
```
62-
63-
#### ArrayPartition
64-
65-
```julia
66-
ArrayPartition(x::AbstractArray...)
67-
```
68-
69-
An `ArrayPartition` `A` is an array, which is made up of different arrays `A.x`.
70-
These index like a single array, but each subarray may have a different type.
71-
However, broadcast is overloaded to loop in an efficient manner, meaning that
72-
`A .+= 2.+B` is type-stable in its computations, even if `A.x[i]` and `A.x[j]`
73-
do not match types. A full array interface is included for completeness, which
74-
allows this array type to be used in place of a standard array where
75-
such a type stable broadcast may be needed. One example is in heterogeneous
76-
differential equations for [DifferentialEquations.jl](https://github.com/JuliaDiffEq/DifferentialEquations.jl).
77-
78-
An `ArrayPartition` acts like a single array. `A[i]` indexes through the first
79-
array, then the second, etc., all linearly. But `A.x` is where the arrays are stored.
80-
Thus, for:
81-
82-
```julia
83-
using RecursiveArrayTools
84-
A = ArrayPartition(y,z)
85-
```
86-
87-
we would have `A.x[1]==y` and `A.x[2]==z`. Broadcasting like `f.(A)` is efficient.
88-
89-
### Functions
90-
91-
```julia
92-
recursivecopy!(b::Array{T,N},a::Array{T,N})
93-
```
94-
95-
A recursive `copy!` function. Acts like a `deepcopy!` on arrays of arrays, but
96-
like `copy!` on arrays of scalars.
97-
98-
```julia
99-
convert(Array,vecvec)
100-
```
101-
102-
Technically, just a Base fallback that works well. Takes in a vector of arrays,
103-
returns an array of dimension one greater than the original elements.
104-
Works on `AbstractVectorOfArray`. If the `vecvec` is ragged, i.e., not all of the
105-
elements are the same, then it uses the size of the first element to determine
106-
the conversion.
107-
108-
```julia
109-
vecvecapply(f::Base.Callable,v)
110-
```
111-
112-
Calls `f` on each element of a vecvec `v`.
113-
114-
```julia
115-
copyat_or_push!{T}(a::AbstractVector{T},i::Int,x)
116-
```
117-
118-
If `i<length(x)`, it's simply a `recursivecopy!` to the `i`th element. Otherwise, it will
119-
`push!` a `deepcopy`.
120-
121-
```julia
122-
recursive_one(a)
123-
```
124-
125-
Calls `one` on the bottom container to get the "true element one type".
126-
127-
```julia
128-
mean{T<:AbstractArray}(vecvec::Vector{T})
129-
mean{T<:AbstractArray}(matarr::Matrix{T},region=0)
130-
```
131-
132-
Generalized mean functions for vectors of arrays and a matrix of arrays.
8+
arrays of arrays.

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
site/

docs/Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[deps]
2+
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
3+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4+
5+
[compat]
6+
Documenter = "0.27"

docs/make.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Documenter, RecursiveArrayTools
2+
3+
include("pages.jl")
4+
5+
makedocs(
6+
sitename="RecursiveArrayTools.jl",
7+
authors="Chris Rackauckas",
8+
modules=[RecursiveArrayTools],
9+
clean=true,doctest=false,
10+
format = Documenter.HTML(analytics = "UA-90474609-3",
11+
assets = ["assets/favicon.ico"],
12+
canonical="https://recursivearraytools.sciml.ai/stable/"),
13+
pages=pages
14+
)
15+
16+
deploydocs(
17+
repo = "github.com/SciML/RecursiveArrayTools.jl.git";
18+
push_preview = true
19+
)

docs/pages.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Put in a separate page so it can be used by SciMLDocs.jl
2+
3+
pages=[
4+
"Home" => "index.md",
5+
"array_types.md",
6+
"recursive_array_functions.md"
7+
]

docs/src/array_types.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Recursive Array Types
2+
3+
The Recursive Array types are types which implement an `AbstractArray` interface so
4+
that recursive arrays can be handled with standard array functionality. For example,
5+
wrapped arrays will automatically do things like recurse broadcast, define optimized
6+
mapping and iteration functions, and more.
7+
8+
## Abstract Types
9+
10+
## Concrete Types
11+
12+
```@docs
13+
VectorOfArray
14+
DiffEqArray
15+
ArrayPartition
16+
```

docs/src/index.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# RecursiveArrayTools.jl: Arrays of Arrays and Even Deeper
2+
3+
RecursiveArrayTools.jl is a set of tools for dealing with recursive arrays like
4+
arrays of arrays. It contains type wrappers for making recursive arrays act more
5+
like normal arrays (for example, automating the recursion of broadcast, maps,
6+
iteration, and more), and utility functions which make it easier to work with
7+
recursive arrays.
8+
9+
## Installation
10+
11+
To install RecursiveArrayTools.jl, use the Julia package manager:
12+
13+
```julia
14+
using Pkg
15+
Pkg.add("RecursiveArrayTools")
16+
```
17+
18+
## Contributing
19+
20+
- Please refer to the
21+
[SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://github.com/SciML/ColPrac/blob/master/README.md)
22+
for guidance on PRs, issues, and other matters relating to contributing to SciML.
23+
- There are a few community forums:
24+
- the #diffeq-bridged channel in the [Julia Slack](https://julialang.org/slack/)
25+
- [JuliaDiffEq](https://gitter.im/JuliaDiffEq/Lobby) on Gitter
26+
- on the [Julia Discourse forums](https://discourse.julialang.org)
27+
- see also [SciML Community page](https://sciml.ai/community/)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Recursive Array Functions
2+
3+
These are functions designed for recursive arrays, like arrays of arrays,
4+
and do not require that the RecursiveArrayTools types are used.
5+
6+
## Function List
7+
8+
```@docs
9+
recursivecopy
10+
recursivecopy!
11+
vecvecapply
12+
copyat_or_push!
13+
```

src/array_partition.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
"""
2+
```julia
3+
ArrayPartition(x::AbstractArray...)
4+
```
5+
6+
An `ArrayPartition` `A` is an array, which is made up of different arrays `A.x`.
7+
These index like a single array, but each subarray may have a different type.
8+
However, broadcast is overloaded to loop in an efficient manner, meaning that
9+
`A .+= 2.+B` is type-stable in its computations, even if `A.x[i]` and `A.x[j]`
10+
do not match types. A full array interface is included for completeness, which
11+
allows this array type to be used in place of a standard array where
12+
such a type stable broadcast may be needed. One example is in heterogeneous
13+
differential equations for [DifferentialEquations.jl](https://github.com/JuliaDiffEq/DifferentialEquations.jl).
14+
15+
An `ArrayPartition` acts like a single array. `A[i]` indexes through the first
16+
array, then the second, etc., all linearly. But `A.x` is where the arrays are stored.
17+
Thus, for:
18+
19+
```julia
20+
using RecursiveArrayTools
21+
A = ArrayPartition(y,z)
22+
```
23+
24+
we would have `A.x[1]==y` and `A.x[2]==z`. Broadcasting like `f.(A)` is efficient.
25+
"""
126
struct ArrayPartition{T,S<:Tuple} <: AbstractVector{T}
227
x::S
328
end

0 commit comments

Comments
 (0)