Skip to content

Commit

Permalink
Merge branch 'master' into as/broadcast-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas authored Dec 19, 2023
2 parents 766fa1b + 094c2bb commit ef7e126
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 7 deletions.
1 change: 0 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- Downstream
version:
- '1'
- '1.6'
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
julia-version: [1,1.6]
julia-version: [1]
os: [ubuntu-latest]
package:
- {user: SciML, repo: SciMLBase.jl, group: Core}
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Spell Check

on: [pull_request]

jobs:
typos-check:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check spelling
uses: crate-ci/[email protected]
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[default.extend-words]
15 changes: 15 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,31 @@ RecursiveArrayToolsZygoteExt = "Zygote"

[compat]
Adapt = "3, 4"
Aqua = "0.8"
ArrayInterface = "7"
DocStringExtensions = "0.8, 0.9"
ForwardDiff = "0.10"
GPUArraysCore = "0.1"
IteratorInterfaceExtensions = "1"
LabelledArrays = "1"
LinearAlgebra = "1"
Measurements = "2"
MonteCarloMeasurements = "1"
NLsolve = "4"
Pkg = "1"
Random = "1"
RecipesBase = "0.7, 0.8, 1.0"
Requires = "1.0"
SafeTestsets = "0.1"
StaticArrays = "0.12"
StaticArraysCore = "1.1"
Statistics = "1"
StructArrays = "0.6"
SymbolicIndexingInterface = "0.3"
Tables = "1"
Test = "1"
Tracker = "0.2"
Unitful = "1"
Zygote = "0.6.56"
julia = "1.9"

Expand Down
22 changes: 22 additions & 0 deletions src/vector_of_array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,34 @@ function Base.copy(VA::AbstractDiffEqArray)
(VA.sys === nothing) ? nothing : copy(VA.sys))
end
Base.copy(VA::AbstractVectorOfArray) = typeof(VA)(copy(VA.u))

Base.zero(VA::VectorOfArray) = VectorOfArray(Base.zero.(VA.u))

function Base.zero(VA::DiffEqArray)
u = Base.zero.(VA.u)
DiffEqArray(u, VA.t, VA.p, VA.sys)
end

Base.sizehint!(VA::AbstractVectorOfArray{T, N}, i) where {T, N} = sizehint!(VA.u, i)

Base.reverse!(VA::AbstractVectorOfArray) = reverse!(VA.u)
Base.reverse(VA::VectorOfArray) = VectorOfArray(reverse(VA.u))
Base.reverse(VA::DiffEqArray) = DiffEqArray(reverse(VA.u), VA.t, VA.p, VA.sys)

function Base.resize!(VA::AbstractVectorOfArray, i::Integer)
if Base.hasproperty(VA, :sys) && VA.sys !== nothing
error("resize! is not allowed on AbstractVectorOfArray with a sys")
end
Base.resize!(VA.u, i)
if Base.hasproperty(VA, :t) && VA.t !== nothing
Base.resize!(VA.t, i)
end
end

function Base.pointer(VA::AbstractVectorOfArray)
Base.pointer(VA.u)
end

function Base.push!(VA::AbstractVectorOfArray{T, N}, new_item::AbstractArray) where {T, N}
push!(VA.u, new_item)
end
Expand Down
5 changes: 5 additions & 0 deletions test/interface_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ z = VectorOfArray([zeros(SVector{2, Float64}), zeros(SVector{2, Float64})])
z .= x .+ y

@test z == VectorOfArray([fill(4, SVector{2, Float64}), fill(2, SVector{2, Float64})])

u = VectorOfArray([fill(2, SVector{2, Float64}), ones(SVector{2, Float64})])
@test typeof(zero(u)) <: typeof(u)
resize!(u,3)
@test pointer(u) === pointer(u.u)
11 changes: 11 additions & 0 deletions test/qa.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using RecursiveArrayTools, Aqua
@testset "Aqua" begin
Aqua.find_persistent_tasks_deps(RecursiveArrayTools)
Aqua.test_ambiguities(RecursiveArrayTools, recursive = false, broken = true)
Aqua.test_deps_compat(RecursiveArrayTools)
Aqua.test_piracies(RecursiveArrayTools)
Aqua.test_project_extras(RecursiveArrayTools)
Aqua.test_stale_deps(RecursiveArrayTools)
Aqua.test_unbound_args(RecursiveArrayTools)
Aqua.test_undefined_exports(RecursiveArrayTools)
end
8 changes: 3 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using Pkg
using RecursiveArrayTools
using Test
using Aqua
using SafeTestsets

if VERSION >= v"1.9"
Aqua.test_all(RecursiveArrayTools, ambiguities = false)
end

@test_broken isempty(Test.detect_ambiguities(RecursiveArrayTools))
const GROUP = get(ENV, "GROUP", "All")
const is_APPVEYOR = (Sys.iswindows() && haskey(ENV, "APPVEYOR"))
Expand All @@ -26,6 +21,9 @@ end

@time begin
if GROUP == "Core" || GROUP == "All"
@time @safetestset "Quality Assurance" begin
include("qa.jl")
end
@time @safetestset "Utils Tests" begin
include("utils_test.jl")
end
Expand Down

0 comments on commit ef7e126

Please sign in to comment.