From 7bb5f08add780fe3fb08c213b21fb8b3c9248b4a Mon Sep 17 00:00:00 2001 From: Vedant Puri Date: Wed, 1 Nov 2023 13:01:24 -0400 Subject: [PATCH] Replace `.*(Number, Diagonal)` with `*(Number, Diagonal)` The result with / without broadcasting here is the same. Removing the broadcast here would avoid https://github.com/JuliaGPU/CUDA.jl/issues/2140. Further, when `cache.DtD.diag isa ComponentVector` that CUDA bug would lead to scalar indexing error on GPU. --- src/levenberg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/levenberg.jl b/src/levenberg.jl index bb9f88bd9..408074cdb 100644 --- a/src/levenberg.jl +++ b/src/levenberg.jl @@ -374,7 +374,7 @@ function perform_step!(cache::LevenbergMarquardtCache{false, fastls}) where {fas # Usual Levenberg-Marquardt step ("velocity"). if fastls - cache.mat_tmp = vcat(J, λ .* cache.DᵀD) + cache.mat_tmp = vcat(J, λ * cache.DᵀD) cache.rhs_tmp[1:length(fu1)] .= -_vec(fu1) linres = dolinsolve(alg.precs, linsolve; A = cache.mat_tmp, b = cache.rhs_tmp, linu = _vec(cache.v), p = p, reltol = cache.abstol)