Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions lib/SciMLJacobianOperators/src/SciMLJacobianOperators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,35 @@ function get_dense_ad(ad::AutoSparse)
return dense_ad
end

function Base.copy(J::JacobianOperator)
return JacobianOperator(
J.mode,
J.jvp_op,
J.vjp_op,
copy(J.size),
J.input_cache === nothing ? nothing : copy(J.input_cache),
J.output_cache === nothing ? nohting : copy(J.output_cache)
)
end

function Base.copy(J::StatefulJacobianOperator)
return StatefulJacobianOperator(
copy(J.jac_op),
J.u === nothing ? nothing : copy(J.u),
J.p === nothing ? nothing : copy(J.p)
)
end

function Base.copy(J::StatefulJacobianNormalFormOperator)
return StatefulJacobianNormalFormOperator(
J.vjp_operator === nothing ? nothing : copy(J.vjp_operator),
J.jvp_operator === nothing ? nothing : copy(J.jvp_operator),
J.cache === nothing ? nothing : copy(J.cache)
)

end


export JacobianOperator, VecJacOperator, JacVecOperator
export StatefulJacobianOperator
export StatefulJacobianNormalFormOperator
Expand Down
Loading