From 453aebce2b8ceec21979301966cc28d42043850c Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Fri, 21 Mar 2025 23:05:40 -0500 Subject: [PATCH 1/2] make BlockedSparse, add note why other types must be mutable --- src/Xymat.jl | 3 +++ src/arraytypes.jl | 2 +- src/remat.jl | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Xymat.jl b/src/Xymat.jl index 79ddffbc4..ba13aed43 100644 --- a/src/Xymat.jl +++ b/src/Xymat.jl @@ -104,6 +104,9 @@ Typically, an `FeMat` represents the fixed-effects model matrix with the respons Upon construction the `xy` and `wtxy` fields refer to the same matrix """ mutable struct FeMat{T,S<:AbstractMatrix} <: AbstractMatrix{T} + # XXX This struct must be mutable, because in the unweighted + # case wtxy === xy and we allow users to reweight posthoc, + # at which point wtxy is replaced by a new matrix xy::S wtxy::S end diff --git a/src/arraytypes.jl b/src/arraytypes.jl index 9354bfdcb..da485f170 100644 --- a/src/arraytypes.jl +++ b/src/arraytypes.jl @@ -60,7 +60,7 @@ A `SparseMatrixCSC` whose nonzeros form blocks of rows or columns or both. The only time these are created are as products of `ReMat`s. """ -mutable struct BlockedSparse{T,S,P} <: AbstractMatrix{T} +struct BlockedSparse{T,S,P} <: AbstractMatrix{T} cscmat::SparseMatrixCSC{T,Int32} nzsasmat::Matrix{T} colblkptr::Vector{Int32} diff --git a/src/remat.jl b/src/remat.jl index ee40c53e6..01d4eadf4 100644 --- a/src/remat.jl +++ b/src/remat.jl @@ -18,6 +18,9 @@ A section of a model matrix generated by a random-effects term. - `scratch`: a `Matrix{T}` """ mutable struct ReMat{T,S} <: AbstractReMat{T} + # XXX This struct must be mutable, because in the unweighted + # case wtz === z and we allow users to reweight posthoc, + # at which point wtxy is replaced by a new matrix trm::Any refs::Vector{Int32} levels::Any From 64e05be6116587c5f943c0dfb6d05cd3298f3080 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Fri, 21 Mar 2025 23:10:33 -0500 Subject: [PATCH 2/2] NEWS + version bump --- NEWS.md | 5 +++++ Project.toml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 049757e33..3dd27506a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +MixedModels v4.34.0 Release Notes +============================== +- `BlockedSparse` is now immutable. [#815] + MixedModels v4.33.0 Release Notes ============================== - `LikelihoodRatioTest` now extends `StatsAPI.HypothesisTest` and provides a method for `StatsAPI.pvalue`. [#814] @@ -617,3 +621,4 @@ Package dependencies [#802]: https://github.com/JuliaStats/MixedModels.jl/issues/802 [#810]: https://github.com/JuliaStats/MixedModels.jl/issues/810 [#814]: https://github.com/JuliaStats/MixedModels.jl/issues/814 +[#815]: https://github.com/JuliaStats/MixedModels.jl/issues/815 diff --git a/Project.toml b/Project.toml index 26dbea47b..3e26352f0 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MixedModels" uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316" author = ["Phillip Alday ", "Douglas Bates "] -version = "4.33.0" +version = "4.34.0" [deps] Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"