You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function EnzymeCore.EnzymeRules.reverse(config, func::Const{typeof(LinearSolve.init)}, ::Type{RT}, cache, prob::EnzymeCore.Annotation{LP}, alg::Const; kwargs...) where {RT, LP <:LinearSolve.LinearProblem}
49
+
d_A, d_b, prob_d_A, prob_d_b = cache
50
+
51
+
if EnzymeRules.width(config) ==1
52
+
if d_A !== prob_d_A
53
+
prob_d_A .+= d_A
54
+
d_A .=0
55
+
end
56
+
if d_b !== prob_d_b
57
+
prob_d_b .+= d_b
58
+
d_b .=0
59
+
end
60
+
else
61
+
for i in1:EnzymeRules.width(config)
62
+
if d_A !== prob_d_A[i]
63
+
prob_d_A[i] .+= d_A[i]
64
+
d_A[i] .=0
65
+
end
66
+
if d_b !== prob_d_b[i]
67
+
prob_d_b[i] .+= d_b[i]
68
+
d_b[i] .=0
69
+
end
70
+
end
71
+
end
72
+
73
+
return (nothing, nothing)
74
+
end
75
+
76
+
# y=inv(A) B
77
+
# dA −= z y^T
78
+
# dB += z, where z = inv(A^T) dy
79
+
function EnzymeCore.EnzymeRules.augmented_primal(config, func::Const{typeof(LinearSolve.solve!)}, ::Type{RT}, linsolve::EnzymeCore.Annotation{LP}; kwargs...) where {RT, LP <:LinearSolve.LinearCache}
error("Algorithm $(_linsolve.alg) is currently not supported by Enzyme rules on LinearSolve.jl. Please open an issue on LinearSolve.jl detailing which algorithm is missing the adjoint handling")
0 commit comments