Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 9bb0be2

Browse files
committed
Merge branch 'master' into travis-up
2 parents f81b25e + 7db65c7 commit 9bb0be2

File tree

5 files changed

+43
-4
lines changed

5 files changed

+43
-4
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CompatHelper
2+
3+
on:
4+
schedule:
5+
- cron: '00 * * * *'
6+
issues:
7+
types: [opened, reopened]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
julia-version: [1.2.0]
15+
julia-arch: [x86]
16+
os: [ubuntu-latest]
17+
steps:
18+
- uses: julia-actions/setup-julia@latest
19+
with:
20+
version: ${{ matrix.julia-version }}
21+
- name: Pkg.add("CompatHelper")
22+
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
23+
- name: CompatHelper.main()
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
run: julia -e 'using CompatHelper; CompatHelper.main()'

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SparseDiffTools"
22
uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
33
authors = ["Pankaj Mishra <[email protected]>", "Chris Rackauckas <[email protected]>"]
4-
version = "0.10.2"
4+
version = "0.10.3"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/differentiation/compute_jacobian_ad.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ end
6666

6767
function forwarddiff_color_jacobian(f,
6868
x::AbstractArray{<:Number};
69-
dx = similar(x), #if dx is nothing, we will estimate dx at the cost of a function call
69+
dx = copy(x), #if dx is nothing, we will estimate dx at the cost of a function call
7070
colorvec = 1:length(x),
7171
sparsity = nothing,
7272
jac_prototype = nothing)
@@ -87,7 +87,7 @@ function forwarddiff_color_jacobian(f,x::AbstractArray{<:Number},jac_cache::Forw
8787
maxcolor = maximum(colorvec)
8888

8989
vecx = vec(x)
90-
90+
9191
J = jac_prototype isa Nothing ? (sparsity isa Nothing ? false .* vec(dx) .* vecx' : zeros(eltype(x),size(sparsity))) : zero(jac_prototype)
9292
nrows,ncols = size(J)
9393

test/test_ad.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,5 @@ forwarddiff_color_jacobian!(J,iipf,x,dx=similar(x))
224224
x = SVector{1}([1.])
225225
f(x) = x
226226
J = forwarddiff_color_jacobian(f,x)
227-
@test J SMatrix{1,1}([1.])
227+
@test J isa SArray
228+
@test J SMatrix{1,1}([1.])

test/test_integration.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ using SparsityDetection
55
using LinearAlgebra, SparseArrays, Test
66

77
fcalls = 0
8+
9+
function f(x)
10+
global fcalls += 1
11+
dx = similar(x)
12+
for i in 2:length(x)-1
13+
dx[i] = x[i-1] - 2x[i] + x[i+1]
14+
end
15+
dx[1] = -2x[1] + x[2]
16+
dx[end] = x[end-1] - 2x[end]
17+
dx
18+
end
19+
820
function f(dx,x)
921
global fcalls += 1
1022
for i in 2:length(x)-1

0 commit comments

Comments
 (0)