@@ -181,22 +181,26 @@ end
181
181
182
182
# If setting A or b for DualLinearCache, put the Dual-stripped versions in the LinearCache
183
183
function Base. setproperty! (dc:: DualLinearCache , sym:: Symbol , val)
184
- if sym === :A
184
+ # If the property is A or b, also update it in the LinearCache
185
+ if sym === :A || sym === :b || sym === :u
185
186
setproperty! (dc. linear_cache, sym, nodual_value (val))
187
+ elseif hasfield (DualLinearCache, sym)
188
+ setfield! (dc, sym, val)
189
+ elseif hasfield (LinearSolve. LinearCache, sym)
190
+ setproperty! (dc. linear_cache, sym, val)
191
+ end
192
+
193
+
194
+ # Update the partials if setting A or b
195
+ if sym === :A
186
196
setfield! (dc, :dual_A , val)
187
197
setfield! (dc, :partials_A , partial_vals (val))
188
198
elseif sym === :b
189
- setproperty! (dc. linear_cache, sym, nodual_value (val))
190
199
setfield! (dc, :dual_b , val)
191
200
setfield! (dc, :partials_b , partial_vals (val))
192
201
elseif sym === :u
193
- setproperty! (dc. linear_cache, sym, nodual_value (val))
194
202
setfield! (dc, :dual_u , val)
195
203
setfield! (dc, :partials_u , partial_vals (val))
196
- elseif hasfield (DualLinearCache, sym)
197
- setfield! (dc,sym,val)
198
- elseif hasfield (LinearSolve. LinearCache, sym)
199
- setproperty! (dc. linear_cache, sym, val)
200
204
end
201
205
end
202
206
@@ -236,7 +240,7 @@ nodual_value(x::Dual{T, V, P}) where {T, V <: Dual, P} = x.value # Keep the inn
236
240
nodual_value (x:: AbstractArray{<:Dual} ) = map (nodual_value, x)
237
241
238
242
239
- function partials_to_list (partial_matrix:: AbstractArray{T, 1 } ) where {T}
243
+ function partials_to_list (partial_matrix:: AbstractVector{T } ) where {T}
240
244
p = eachindex (first (partial_matrix))
241
245
[[partial[i] for partial in partial_matrix] for i in p]
242
246
end
0 commit comments