From 01caefed2dc72f4714fb5f77836dcea5bb265c85 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Tue, 16 Jan 2024 21:24:49 -0600 Subject: [PATCH 1/3] Replace broadcasted lambda with explicit loop --- src/remat.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/remat.jl b/src/remat.jl index a23430190..b350cd059 100644 --- a/src/remat.jl +++ b/src/remat.jl @@ -564,7 +564,10 @@ function copyscaleinflate! end function copyscaleinflate!(Ljj::Diagonal{T}, Ajj::Diagonal{T}, Λj::ReMat{T,1}) where {T} Ldiag, Adiag = Ljj.diag, Ajj.diag - broadcast!((x, λsqr) -> x * λsqr + one(T), Ldiag, Adiag, abs2(only(Λj.λ))) + lambsq = abs2(only(Λj.λ.data)) + @inbounds for i in eachindex(Ldiag, Adiag) + Ldiag[i] = lambsq * Adiag[i] + one(T) + end return Ljj end @@ -606,14 +609,14 @@ function copyscaleinflate!( iszero(r) || throw(DimensionMismatch("size(Ljj, 1) is not a multiple of S")) λ = Λj.λ offset = 0 - @inbounds for k in 1:q + @inbounds for _ in 1:q inds = (offset + 1):(offset + S) tmp = view(Ljj, inds, inds) lmul!(adjoint(λ), rmul!(tmp, λ)) offset += S end for k in diagind(Ljj) - Ljj[k] += 1 + Ljj[k] += one(T) end return Ljj end From f748fa09bc4d658f329adaea037cb145765c241f Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Tue, 5 Mar 2024 11:14:13 -0600 Subject: [PATCH 2/3] version bump and NEWS --- NEWS.md | 4 ++++ Project.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index f0c4aefd7..cda5f8213 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +MixedModels v4.22.5 Release Notes +============================== +* Replace broadcasted lambda with explicit loop and use `one`. This may result in a small performance improvement. [#738] + MixedModels v4.22.4 Release Notes ============================== * Switch to explicit imports from all included packages (i.e. replace `using Foo` by `using Foo: Foo, bar, baz`) [#748] diff --git a/Project.toml b/Project.toml index 2a6d9d685..30112b4d9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MixedModels" uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316" author = ["Phillip Alday ", "Douglas Bates ", "Jose Bayoan Santiago Calderon "] -version = "4.22.4" +version = "4.22.5" [deps] Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45" From dda6e091dffe7e2c49b8ed9af19e6f21dbe14d6b Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Tue, 5 Mar 2024 11:15:31 -0600 Subject: [PATCH 3/3] NEWS xref --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index cda5f8213..4a30410f3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -499,5 +499,6 @@ Package dependencies [#715]: https://github.com/JuliaStats/MixedModels.jl/issues/715 [#717]: https://github.com/JuliaStats/MixedModels.jl/issues/717 [#733]: https://github.com/JuliaStats/MixedModels.jl/issues/733 +[#738]: https://github.com/JuliaStats/MixedModels.jl/issues/738 [#744]: https://github.com/JuliaStats/MixedModels.jl/issues/744 [#748]: https://github.com/JuliaStats/MixedModels.jl/issues/748