Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions ext/LinearSolveForwardDiffExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,9 @@ function partials_to_list(partial_matrix::SparseMatrixCSC)
V = ForwardDiff.valtype(T) # use type for concrete array below in empty-nz case (e.g. all-zero Jacobian at init)
return [
SparseMatrixCSC(
m, n, partial_matrix.colptr, partial_matrix.rowval,
V[nz[i][k] for i in eachindex(nz)]
) for k in 1:p
m, n, partial_matrix.colptr, partial_matrix.rowval,
V[nz[i][k] for i in eachindex(nz)]
) for k in 1:p
]
end

Expand Down
10 changes: 5 additions & 5 deletions test/Core/forwarddiff_gpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ end
function dual_problem(n, p)
A = [
ForwardDiff.Dual{Nothing}(
float(i == j ? 10 + i : 0.3 * (i + j)), ntuple(k -> 0.1k + 0.01 * (i + j), p)
) for i in 1:n, j in 1:n
float(i == j ? 10 + i : 0.3 * (i + j)), ntuple(k -> 0.1k + 0.01 * (i + j), p)
) for i in 1:n, j in 1:n
]
b = [ForwardDiff.Dual{Nothing}(float(i), ntuple(k -> 0.05k + 0.1i, p)) for i in 1:n]
return A, b
Expand All @@ -42,9 +42,9 @@ value_error(got, ref) = maximum(abs, ForwardDiff.value.(got) .- ForwardDiff.valu
function partials_error(got, ref)
return maximum(
maximum(
abs,
collect(ForwardDiff.partials(x)) .- collect(ForwardDiff.partials(y))
) for (x, y) in zip(got, ref)
abs,
collect(ForwardDiff.partials(x)) .- collect(ForwardDiff.partials(y))
) for (x, y) in zip(got, ref)
)
end

Expand Down
16 changes: 8 additions & 8 deletions test/Core/forwarddiff_overloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ prob = LinearProblem(sparse(plain_A), b)
for nchunk in (1, 2, 3)
bd = [
ForwardDiff.Dual{Nothing, Float64, nchunk}(
Float64(i), ForwardDiff.Partials(ntuple(k -> sin(i + k), nchunk))
) for i in 1:5
Float64(i), ForwardDiff.Partials(ntuple(k -> sin(i + k), nchunk))
) for i in 1:5
]
cache = LinearSolve.__init(LinearProblem(Asp, bd), PureKLUFactorization())
@test eltype(cache.A) == Float64 # A not promoted
Expand All @@ -313,9 +313,9 @@ prob = LinearProblem(sparse(plain_A), b)
@test isapprox(ForwardDiff.value.(u), ForwardDiff.value.(uref); rtol = 1.0e-10)
@test all(
isapprox(
ForwardDiff.partials(u[i], j), ForwardDiff.partials(uref[i], j);
rtol = 1.0e-8, atol = 1.0e-12
) for i in 1:5, j in 1:nchunk
ForwardDiff.partials(u[i], j), ForwardDiff.partials(uref[i], j);
rtol = 1.0e-8, atol = 1.0e-12
) for i in 1:5, j in 1:nchunk
)
end

Expand Down Expand Up @@ -863,9 +863,9 @@ end
p = 3
A = [
ForwardDiff.Dual{Nothing}(
float(i == j ? 10 + i : 0.3 * (i + j)),
ntuple(k -> 0.1k + 0.01 * (i + j), p)
) for i in 1:n, j in 1:n
float(i == j ? 10 + i : 0.3 * (i + j)),
ntuple(k -> 0.1k + 0.01 * (i + j), p)
) for i in 1:n, j in 1:n
]
b = [ForwardDiff.Dual{Nothing}(float(i), ntuple(k -> 0.05k + 0.1i, p)) for i in 1:n]
reference = solve(LinearProblem(A, b), LUFactorization()).u
Expand Down
4 changes: 2 additions & 2 deletions test/qa/allocations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ const DUAL_XP_LINSOLVE_RHS! = getproperty(
function dual_linear_problem(n, p)
A = [
ForwardDiff.Dual{Nothing}(
float(i == j ? 10 + i : 0.3 * (i + j)), ntuple(k -> 0.1k + 0.01 * (i + j), p)
) for i in 1:n, j in 1:n
float(i == j ? 10 + i : 0.3 * (i + j)), ntuple(k -> 0.1k + 0.01 * (i + j), p)
) for i in 1:n, j in 1:n
]
b = [ForwardDiff.Dual{Nothing}(float(i), ntuple(k -> 0.05k + 0.1i, p)) for i in 1:n]
return A, b
Expand Down
Loading