Skip to content

Commit 058b87d

Browse files
committed
feat: remove Setfield dep
1 parent 63a5594 commit 058b87d

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/SciMLJacobianOperators/Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
1313
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1414
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
1515
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
16-
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
1716

1817
[compat]
1918
ADTypes = "1.8.1"
@@ -32,7 +31,6 @@ LinearAlgebra = "1.10"
3231
ReverseDiff = "1.15"
3332
SciMLBase = "2.54.0"
3433
SciMLOperators = "0.3"
35-
Setfield = "1"
3634
Test = "1.10"
3735
TestItemRunner = "1"
3836
Tracker = "0.2.35"

lib/SciMLJacobianOperators/src/SciMLJacobianOperators.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ using FastClosures: @closure
99
using LinearAlgebra: LinearAlgebra
1010
using SciMLBase: SciMLBase, AbstractNonlinearProblem, AbstractNonlinearFunction
1111
using SciMLOperators: AbstractSciMLOperator
12-
using Setfield: @set!
1312

1413
const DI = DifferentiationInterface
1514
const True = Val(true)
@@ -98,13 +97,10 @@ Base.size(J::JacobianOperator) = J.size
9897
Base.size(J::JacobianOperator, d::Integer) = J.size[d]
9998

10099
for op in (:adjoint, :transpose)
101-
@eval function Base.$(op)(operator::JacobianOperator)
102-
@set! operator.mode = flip_mode(operator.mode)
103-
(; output_cache, input_cache) = operator
104-
@set! operator.output_cache = input_cache
105-
@set! operator.input_cache = output_cache
106-
@set! operator.size = reverse(operator.size)
107-
return operator
100+
@eval function Base.$(op)(operator::JacobianOperator{iip, T}) where {iip, T}
101+
return JacobianOperator{iip, T}(
102+
flip_mode(operator.mode), operator.jvp_op, operator.vjp_op,
103+
reverse(operator.size), input_cache, output_cache)
108104
end
109105
end
110106

0 commit comments

Comments
 (0)