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
1 change: 1 addition & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
style = "sciml"
format_markdown = true
42 changes: 42 additions & 0 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: format-check

on:
push:
branches:
- 'master'
- 'release-'
tags: '*'
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v1
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(".", verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
5 changes: 1 addition & 4 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ The RecursiveArrayTools.jl package is licensed under the MIT "Expat" License:
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
>

The chain function is from Iterators.jl and is licensed under the MIT License:

>Copyright (c) 2012-2016: Daniel Jones, Stefan Karpinski, Simon Kornblith, Kevin Squire, Jeff Bezanson, Tim Holy, Jonathan Malmaud, Eric Davies, and other contributors.
> Copyright (c) 2012-2016: Daniel Jones, Stefan Karpinski, Simon Kornblith, Kevin Squire, Jeff Bezanson, Tim Holy, Jonathan Malmaud, Eric Davies, and other contributors.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![Build Status](https://github.com/SciML/RecursiveArrayTools.jl/workflows/CI/badge.svg)](https://github.com/SciML/RecursiveArrayTools.jl/actions?query=workflow%3ACI)
[![build status](https://badge.buildkite.com/9eab94781cf0af9a3566e9b9f16abe5aea167b640b88065285.svg?branch=master)](https://buildkite.com/julialang/recursivearraytools-dot-jl)

[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%27s%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
[![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle)

RecursiveArrayTools.jl is a set of tools for dealing with recursive arrays like
Expand All @@ -31,8 +31,8 @@ vB = VectorOfArray(b)

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

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

Expand Down
32 changes: 18 additions & 14 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ cp("./docs/Project.toml", "./docs/src/assets/Project.toml", force = true)

include("pages.jl")

makedocs(
sitename="RecursiveArrayTools.jl",
authors="Chris Rackauckas",
modules=[RecursiveArrayTools],
clean=true,doctest=false,
format = Documenter.HTML(analytics = "UA-90474609-3",
assets = ["assets/favicon.ico"],
canonical="https://docs.sciml.ai/RecursiveArrayTools/stable/"),
pages=pages
)
makedocs(sitename = "RecursiveArrayTools.jl",
authors = "Chris Rackauckas",
modules = [RecursiveArrayTools],
clean = true, doctest = false, linkcheck = true,
strict = [
:doctest,
:linkcheck,
:parse_error,
:example_block,
# Other available options are
# :autodocs_block, :cross_references, :docs_block, :eval_block, :example_block, :footnote, :meta_block, :missing_docs, :setup_block
],
format = Documenter.HTML(analytics = "UA-90474609-3",
assets = ["assets/favicon.ico"],
canonical = "https://docs.sciml.ai/RecursiveArrayTools/stable/"),
pages = pages)

deploydocs(
repo = "github.com/SciML/RecursiveArrayTools.jl.git";
push_preview = true
)
deploydocs(repo = "github.com/SciML/RecursiveArrayTools.jl.git";
push_preview = true)
6 changes: 3 additions & 3 deletions docs/pages.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Put in a separate page so it can be used by SciMLDocs.jl

pages=[
pages = [
"Home" => "index.md",
"array_types.md",
"recursive_array_functions.md"
]
"recursive_array_functions.md",
]
2 changes: 1 addition & 1 deletion docs/src/array_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ mapping and iteration functions, and more.
VectorOfArray
DiffEqArray
ArrayPartition
```
```
55 changes: 38 additions & 17 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RecursiveArrayTools.jl: Arrays of Arrays and Even Deeper

RecursiveArrayTools.jl is a set of tools for dealing with recursive arrays like
RecursiveArrayTools.jl is a set of tools for dealing with recursive arrays, like
arrays of arrays. It contains type wrappers for making recursive arrays act more
like normal arrays (for example, automating the recursion of broadcast, maps,
iteration, and more), and utility functions which make it easier to work with
Expand All @@ -17,66 +17,87 @@ Pkg.add("RecursiveArrayTools")

## Contributing

- Please refer to the
[SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://github.com/SciML/ColPrac/blob/master/README.md)
for guidance on PRs, issues, and other matters relating to contributing to SciML.
- There are a few community forums:
- the #diffeq-bridged channel in the [Julia Slack](https://julialang.org/slack/)
- [JuliaDiffEq](https://gitter.im/JuliaDiffEq/Lobby) on Gitter
- on the [Julia Discourse forums](https://discourse.julialang.org)
- see also [SciML Community page](https://sciml.ai/community/)
- Please refer to the
[SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://github.com/SciML/ColPrac/blob/master/README.md)
for guidance on PRs, issues, and other matters relating to contributing to SciML.

- See the [SciML Style Guide](https://github.com/SciML/SciMLStyle) for common coding practices and other style decisions.
- There are a few community forums:

+ The #diffeq-bridged and #sciml-bridged channels in the
[Julia Slack](https://julialang.org/slack/)
+ The #diffeq-bridged and #sciml-bridged channels in the
[Julia Zulip](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged)
+ On the [Julia Discourse forums](https://discourse.julialang.org)
+ See also [SciML Community page](https://sciml.ai/community/)

## Reproducibility

```@raw html
<details><summary>The documentation of this SciML package was built using these direct dependencies,</summary>
```

```@example
using Pkg # hide
Pkg.status() # hide
```

```@raw html
</details>
```

```@raw html
<details><summary>and using this machine and Julia version.</summary>
```

```@example
using InteractiveUtils # hide
versioninfo() # hide
```

```@raw html
</details>
```

```@raw html
<details><summary>A more complete overview of all dependencies and their versions is also provided.</summary>
```

```@example
using Pkg # hide
Pkg.status(;mode = PKGMODE_MANIFEST) # hide
Pkg.status(; mode = PKGMODE_MANIFEST) # hide
```

```@raw html
</details>
```

```@raw html
You can also download the
<a href="
```

```@eval
using TOML
version = TOML.parse(read("../../Project.toml",String))["version"]
name = TOML.parse(read("../../Project.toml",String))["name"]
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Manifest.toml"
version = TOML.parse(read("../../Project.toml", String))["version"]
name = TOML.parse(read("../../Project.toml", String))["name"]
link = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
"/assets/Manifest.toml"
```

```@raw html
">manifest</a> file and the
<a href="
```

```@eval
using TOML
version = TOML.parse(read("../../Project.toml",String))["version"]
name = TOML.parse(read("../../Project.toml",String))["name"]
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Project.toml"
version = TOML.parse(read("../../Project.toml", String))["version"]
name = TOML.parse(read("../../Project.toml", String))["name"]
link = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
"/assets/Project.toml"
```

```@raw html
">project</a> file.
```
```
2 changes: 1 addition & 1 deletion docs/src/recursive_array_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ recursivecopy
recursivecopy!
vecvecapply
copyat_or_push!
```
```
2 changes: 1 addition & 1 deletion ext/RecursiveArrayToolsTrackerExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ function RecursiveArrayTools.recursivecopy!(b::AbstractArray{T, N},
end
end

end
end
2 changes: 1 addition & 1 deletion src/RecursiveArrayTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
import Requires
@static if !isdefined(Base, :get_extension)
function __init__()
Requires.@require Tracker="9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" begin include("../ext/RecursiveArrayToolsTrackerExt.jl") end
Requires.@require Tracker="9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" begin include("../ext/RecursiveArrayToolsTrackerExt.jl") end
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/array_partition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Thus, for:

```julia
using RecursiveArrayTools
A = ArrayPartition(y,z)
A = ArrayPartition(y, z)
```

we would have `A.x[1]==y` and `A.x[2]==z`. Broadcasting like `f.(A)` is efficient.
Expand Down
14 changes: 10 additions & 4 deletions src/tabletraits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ function Tables.rows(A::AbstractDiffEqArray)
N = length(A.u[1])
names = [
:timestamp,
(!(A.sc isa SymbolicIndexingInterface.SymbolCache{Nothing, Nothing, Nothing}) ? (states(A.sc)[i] for i in 1:N) :
(!(A.sc isa SymbolicIndexingInterface.SymbolCache{Nothing, Nothing, Nothing}) ?
(states(A.sc)[i] for i in 1:N) :
(Symbol("value", i) for i in 1:N))...,
]
types = Type[eltype(A.t), (eltype(A.u[1]) for _ in 1:N)...]
else
names = [:timestamp, !(A.sc isa SymbolicIndexingInterface.SymbolCache{Nothing, Nothing, Nothing}) ? states(A.sc)[1] : :value]
names = [
:timestamp,
!(A.sc isa SymbolicIndexingInterface.SymbolCache{Nothing, Nothing, Nothing}) ?
states(A.sc)[1] : :value,
]
types = Type[eltype(A.t), VT]
end
return AbstractDiffEqArrayRows(names, types, A.t, A.u)
Expand All @@ -32,14 +37,15 @@ struct AbstractDiffEqArrayRows{T, U}
end
function AbstractDiffEqArrayRows(names, types, t, u)
AbstractDiffEqArrayRows(Symbol.(names), types,
Dict(Symbol(nm) => i for (i, nm) in enumerate(names)), t, u)
Dict(Symbol(nm) => i for (i, nm) in enumerate(names)), t, u)
end

Base.length(x::AbstractDiffEqArrayRows) = length(x.u)
function Base.eltype(::Type{AbstractDiffEqArrayRows{T, U}}) where {T, U}
AbstractDiffEqArrayRow{eltype(T), eltype(U)}
end
function Base.iterate(x::AbstractDiffEqArrayRows, (t_state, u_state)=(iterate(x.t), iterate(x.u)))
function Base.iterate(x::AbstractDiffEqArrayRows,
(t_state, u_state) = (iterate(x.t), iterate(x.u)))
t_state === nothing && return nothing
u_state === nothing && return nothing
t, _t_state = t_state
Expand Down
Loading