Skip to content

Commit 2766b2a

Browse files
Remove unnecessary fallback copy method
The issue was specifically in FunctionOperator's copy method trying to copy nothing values, not a missing fallback. Removing the unnecessary fallback method that was added earlier. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 6b908d4 commit 2766b2a

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

src/interface.jl

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -461,33 +461,4 @@ function LinearAlgebra.mul!(v::AbstractArray,
461461
mul!(v, concretize(L), u, α, β)
462462
end
463463

464-
"""
465-
Base.copy(L::AbstractSciMLOperator)
466-
467-
Default fallback for copying SciMLOperators. This method provides a safe
468-
fallback for operators that don't have a specific copy method defined,
469-
avoiding the need for deepcopy in LinearSolve.jl initialization paths.
470-
471-
For operators that can be converted to concrete matrices, this creates a new
472-
operator from the copied concrete representation. For operators that cannot
473-
be easily converted, this falls back to deepcopy as a last resort.
474-
"""
475-
function Base.copy(L::AbstractSciMLOperator)
476-
# This is the fallback method - it should only be called if no specific
477-
# copy method is defined for the concrete type
478-
if isconvertible(L)
479-
# Try to reconstruct the operator from its concrete representation
480-
try
481-
concrete = concretize(L)
482-
return MatrixOperator(copy(concrete))
483-
catch
484-
@warn "Failed to copy via concrete representation, falling back to deepcopy"
485-
return deepcopy(L)
486-
end
487-
else
488-
@warn "Using deepcopy fallback for non-convertible operator in Base.copy"
489-
return deepcopy(L)
490-
end
491-
end
492-
493464
#

0 commit comments

Comments
 (0)