@@ -46,7 +46,7 @@ struct VarNamedVector{
46
46
47
47
"""
48
48
vector of transformations, so that `transforms[varname_to_index[vn]]` is a callable
49
- that transformes the value of `vn` back to its original space, undoing any linking and
49
+ that transforms the value of `vn` back to its original space, undoing any linking and
50
50
vectorisation
51
51
"""
52
52
transforms:: TTrans
@@ -62,8 +62,8 @@ struct VarNamedVector{
62
62
"""
63
63
mapping from a variable index to the number of inactive entries for that variable.
64
64
Inactive entries are elements in `vals` that are not part of the value of any variable.
65
- They arise when transformations change the dimension of the value stored. In active
66
- entries always come after the last active entry for the given variable.
65
+ They arise when a variable is set to a new value with a different dimension, in-place.
66
+ Inactive entries always come after the last active entry for the given variable.
67
67
"""
68
68
num_inactive:: OrderedDict{Int,Int}
69
69
@@ -149,7 +149,7 @@ function VarNamedVector(
149
149
)
150
150
end
151
151
152
- # TODO (mhauru) Are we sure we want the last one to be of type Any[]? Might this call
152
+ # TODO (mhauru) Are we sure we want the last one to be of type Any[]? Might this cause
153
153
# unnecessary type instability?
154
154
function VarNamedVector {K,V} () where {K,V}
155
155
return VarNamedVector (OrderedDict {K,Int} (), K[], UnitRange{Int}[], V[], Any[])
@@ -205,7 +205,6 @@ function ==(vnv_left::VarNamedVector, vnv_right::VarNamedVector)
205
205
vnv_left. num_inactive == vnv_right. num_inactive
206
206
end
207
207
208
- # Some `VarNamedVector` specific functions.
209
208
getidx (vnv:: VarNamedVector , vn:: VarName ) = vnv. varname_to_index[vn]
210
209
211
210
getrange (vnv:: VarNamedVector , idx:: Int ) = vnv. ranges[idx]
@@ -219,8 +218,8 @@ gettransform(vnv::VarNamedVector, vn::VarName) = gettransform(vnv, getidx(vnv, v
219
218
"""
220
219
istrans(vnv::VarNamedVector, vn::VarName)
221
220
222
- Return a boolean for whether `vn` is guaranteed to have been transformed so that all of
223
- Euclidean space is its domain .
221
+ Return a boolean for whether `vn` is guaranteed to have been transformed so that its domain
222
+ is all of Euclidean space .
224
223
"""
225
224
istrans (vnv:: VarNamedVector , vn:: VarName ) = vnv. is_unconstrained[getidx (vnv, vn)]
226
225
@@ -289,7 +288,6 @@ Base.length(vnv::VarNamedVector) =
289
288
Base. size (vnv:: VarNamedVector ) = (length (vnv),)
290
289
Base. isempty (vnv:: VarNamedVector ) = isempty (vnv. varnames)
291
290
292
- # TODO : We should probably remove this
293
291
Base. IndexStyle (:: Type{<:VarNamedVector} ) = IndexLinear ()
294
292
295
293
# Dictionary interface.
@@ -686,6 +684,9 @@ function nextrange(vnv::VarNamedVector, x)
686
684
return (offset + 1 ): (offset + length (x))
687
685
end
688
686
687
+ # TODO (mhauru) Might add another specialisation to _compose_no_identity, where if
688
+ # ReshapeTransforms are composed with each other or with a an UnwrapSingeltonTransform, only
689
+ # the latter one would be kept.
689
690
"""
690
691
_compose_no_identity(f, g)
691
692
0 commit comments