Skip to content

Commit f1908b9

Browse files
Import issquare from its owner in ForwardDiff extension (#1125)
Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
1 parent fd8271c commit f1908b9

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

ext/LinearSolveForwardDiffExt.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ using SparseArrays
88
using ForwardDiff
99
using ForwardDiff: Dual, Partials
1010
using SciMLBase
11+
using SciMLOperators: issquare
1112
using RecursiveArrayTools
1213
using SciMLLogging
1314
using ArrayInterface

test/Core/forwarddiff_overloads.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ function dual_isapprox(x, y; rtol)
3232
)
3333
end
3434

35+
@testset "ForwardDiff square-system initialization" begin
36+
A_dual = [
37+
ForwardDiff.Dual(2.0, 1.0) ForwardDiff.Dual(1.0, 0.0)
38+
ForwardDiff.Dual(1.0, 0.0) ForwardDiff.Dual(3.0, 1.0)
39+
]
40+
b_dual = [ForwardDiff.Dual(1.0, 1.0), ForwardDiff.Dual(2.0, 0.0)]
41+
sol = solve(LinearProblem(A_dual, b_dual), LUFactorization())
42+
@test dual_isapprox(sol.u, A_dual \ b_dual; rtol = 1.0e-9)
43+
end
44+
3545
A, b = h([ForwardDiff.Dual(5.0, 1.0, 0.0), ForwardDiff.Dual(5.0, 0.0, 1.0)])
3646
prob = LinearProblem(A, b)
3747
backslash_x_p = A \ b

0 commit comments

Comments
 (0)