Does anyone know why there would be a change in the output type of the following code between Julia versions 1.8 and 1.9?:
using ForwardDiff, StaticArrays
ForwardDiff.jacobian(z -> SVector{2}(z[1], z[2]), zeros(SVector{2, Float64}))
Outputs:
Julia 1.8.2, ForwardDiff 0.10.35:
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
1.0 0.0
0.0 1.0
Julia 1.9.0, ForwardDiff 0.10.35:
2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
I cannot reproduce.
julia> versioninfo()
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin22.4.0)
CPU: 16 × Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
Threads: 16 on 16 virtual cores
Environment:
LD_LIBRARY_PATH = /Users/xxx/usr/lib/:/Users/xxx/usr/lib/:
JULIA_NUM_THREADS = 16
(jl_2UjAWm) pkg> st
Status `/private/var/folders/kj/g4l55jh967zgr_gdj12tbjdm0000gn/T/jl_2UjAWm/Project.toml`
[f6369f11] ForwardDiff v0.10.35
[90137ffa] StaticArrays v1.5.24
julia> using ForwardDiff, StaticArrays
julia> ForwardDiff.jacobian(z -> SVector{2}(z[1], z[2]), zeros(SVector{2, Float64}))
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
1.0 0.0
0.0 1.0
1 Like
Ah, many thanks for checking, @fgerick . Updating StaticArrays from 1.5.21 to 1.5.24 also fixed it for me.
It might also be related to this issue.