JuliaDiff / TaylorDiff.jl

Taylor-mode automatic differentiation for higher-order derivatives
https://juliadiff.org/TaylorDiff.jl/
MIT License
73 stars 8 forks source link

Change AbstractVector to AbstractArray{T,1} #45

Closed mBarreau closed 1 year ago

mBarreau commented 1 year ago

Currently, it is not possible to use slices of a matrix in TaylorDiff because this is not of type AbstractVector (see https://discourse.julialang.org/t/speed-up-compilation-with-zygote-and-pinn/99652/4 where a conversion is needed)

This PR changes the type AbstractVector{N} to AbstractArray{T,1}, allowing the use of subvectors.

tansongchen commented 1 year ago

Hi, this is definitely reasonable and thanks for help.

tansongchen commented 1 year ago

Wait, @mBarreau , isn't it that AbstractVector and AbstractArray{T, 1} are the same thing?

julia> AbstractVector
AbstractVector (alias for AbstractArray{T, 1} where T)
mBarreau commented 1 year ago

@tansongchen I did not see you replied. Indeed it is, I was incorrect on the source of the error (I worked on an old version of TaylorDiff initially). The problem with the current code is that x and l must be of same type. This is something I talk about in the other PR: https://github.com/JuliaDiff/TaylorDiff.jl/pull/47