Skip to content

Commit 9b0a3d3

Browse files
authored
fix Union in SArray aggregation code (#168)
* fix Union in SArray aggregation code * fix typo
1 parent 93900b5 commit 9b0a3d3

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Fixed
1515
### Security
1616

17+
## 0.8.23
18+
19+
### Fixed
20+
21+
- eliminate `Union` in `as(SArray{}, ...)` implementation
22+
1723
## 0.8.22
1824

1925
### Fixed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TransformVariables"
22
uuid = "84d833dd-6860-57f9-a1a7-6da5db126cff"
33
authors = ["Tamas K. Papp <tkpapp@gmail.com>"]
4-
version = "0.8.22"
4+
version = "0.8.23"
55

66
[deps]
77
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"

src/aggregation.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,15 @@ function transform_with(flag::LogJacFlag, transformation::StaticArrayTransformat
207207
y1, ℓ1, index1 = transform_with(flag, inner_transformation, x, index)
208208
D == 1 && return SArray{S}(y1), ℓ1, index1
209209
= Ref(ℓ1)
210-
index = Ref(index1)
210+
cum_index = Ref(index1)
211211
function _f(_)
212-
y, ℓΔ, index′ = transform_with(flag, inner_transformation, x, index[])
213-
index[] = index′
212+
y, ℓΔ, index′ = transform_with(flag, inner_transformation, x, cum_index[])
213+
cum_index[] = index′
214214
ℓ[] += ℓΔ
215215
y
216216
end
217217
yrest = SVector{D-1}(_f(i) for i in 2:D)
218-
SArray{S}(pushfirst(yrest, y1)), ℓ[], index[]
218+
SArray{S}(pushfirst(yrest, y1)), ℓ[], cum_index[]
219219
end
220220

221221
function inverse_eltype(transformation::Union{ArrayTransformation,StaticArrayTransformation},

0 commit comments

Comments
 (0)