From b71300d20113ff50bcb0a5796634569fecb6dfde Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Thu, 5 Oct 2023 21:13:42 -0400 Subject: [PATCH] similar doesn't preserve the sparsity pattern --- Project.toml | 2 +- src/highlevel/common.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index c34c485a..bc720e6a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SparseDiffTools" uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804" authors = ["Pankaj Mishra ", "Chris Rackauckas "] -version = "2.7.0" +version = "2.8.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/src/highlevel/common.jl b/src/highlevel/common.jl index a2209005..133cfa3b 100644 --- a/src/highlevel/common.jl +++ b/src/highlevel/common.jl @@ -260,6 +260,7 @@ function init_jacobian(c::AbstractMaybeSparseJacobianCache) end init_jacobian(::Nothing, ::Type{T}, fx, x) where {T} = similar(fx, T, length(fx), length(x)) init_jacobian(J, ::Type{T}, _, _) where {T} = similar(J, T, size(J, 1), size(J, 2)) +init_jacobian(J::SparseMatrixCSC, ::Type{T}, _, _) where {T} = T.(J) __maybe_copy_x(_, x) = x __maybe_copy_x(_, ::Nothing) = nothing