Skip to content

Conversation

jClugstor
Copy link
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Trying to address SciML/OrdinaryDiffEq.jl#2837 and #648

This gets rid of the call to deepcopy.

This also puts the type of the dual number that needs to be constructed in to the type system instead of having it be a field in the dual caches. I'm not sure if that will help with trimming but I think in general it's a better way to do this.

@ChrisRackauckas ChrisRackauckas merged commit b307bb0 into SciML:main Aug 13, 2025
114 of 118 checks passed
@topolarity
Copy link

Looks like there are still some deepcopys in __init:

Stacktrace:
  [1] deepcopy_internal(x::Any, stackdict::IdDict{Any, Any})
    @ Base deepcopy.jl:69
  [2] deepcopy(x::LinearAlgebra.Symmetric{Float64, Matrix{Float64}})
    @ Base deepcopy.jl:29 [inlined]
  [3] __init(::SciMLBase.LinearProblem{Vector{Float64}, true, LinearAlgebra.Symmetric{Float64, Matrix{Float64}}, Vector{Float64}, SciMLBase.NullParameters, Nothing, @Kwargs{abstol::Float64, reltol::Float64}}, ::LinearSolve.CholeskyFactorization{LinearAlgebra.NoPivot, Nothing}; alias::SciMLBase.LinearAliasSpecifier, abstol::Float64, reltol::Float64, maxiters::Int64, verbose::Bool, Pl::Nothing, Pr::Nothing, assumptions::LinearSolve.OperatorAssumptions{Bool}, sensealg::LinearSolve.LinearSolveAdjoint{Missing}, kwargs::@Kwargs{})
    @ LinearSolve ~/repos/LinearSolve.jl/src/common.jl:324 [inlined]
...

@jClugstor
Copy link
Member Author

jClugstor commented Aug 18, 2025

I should have named this "Remove deepcopy in solve! for DualLinearCache" etc. . I wasn't looking at any of the other deepcopy calls.

@jClugstor jClugstor changed the title Get rid of deepcopy, put Dual types in type system Remove deepcopy in solve! for DualLinearCache, put Dual types in type system Aug 18, 2025
@topolarity
Copy link

Makes sense, thanks for the clarification - that probably means #648 should be left open

RomeoV added a commit to RomeoV/NonlinearSolve.jl that referenced this pull request Aug 19, 2025
Problem was solved in SciML/LinearSolve.jl#724,
although SciML/LinearSolve.jl#648 just got reopened.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants